View Full Version : Web Design help - emails and search
I'm just setting up a website for a friend, its fairly simple and i've had no problem doing the basics but it now requires a link on the top of each page to 'search the site'
I've added the search button and the textfield box which the search term is added into but how do i then point it to the search results page and how do i code for the search? its not something i have come across before.
The second thing is (hopefully this will be easier to set up):
I need another textfield input box which people can put their email addresses into and press submit to add them to a monthly newsletter, all i really require is something simple whereby them hitting submit sends me an email with their email address in it(if that makes sense :D ) then i can just add them to the contacts list manually.
any help would be great, thanks
maddogsuk
21-08-2005, 18:12
For your search you could use the Free Google Site search here (http://www.google.com/searchcode.html) They give you all the code, just paste it into your site and make the text changes to the code for your domian.
The email part, depends on what the server your hosting the site supports. I use Formmail (http://www.tectite.com/formmailpage.php) for that sort of thing. :)
thanks for the help.
Unfortunately formmail looks a bit more complicated than i had hoped, i don't really need a complete contact form, just something containing the persons email address that they added to the box.
Is there a simple code just for this? i've had a quick read through the formmail readme file but couldn't see anything immediately obvious.
Chris Locke
21-08-2005, 18:32
Does your hosting support php? The textbox to hold the username would be part of a form, which is submitted to a php page. This page then sends you an email with the contents of that textbox. All very simple to setup. Yell if you want an example.
Thanks chris, i know my host supports php and i've set up the textbox on the website (using dreamweaver)
if you could provide an example that would be great :thumbs:
Chris Locke
21-08-2005, 19:54
OK, I've uploaded some files into my temp area (http://www.creapsoft.co.uk/temp/).
mail_example.htm (http://www.creapsoft.co.uk/temp/mail_example.htm) is the html file which contains the form. This calls mail.php (also saved as mail.php.txt (http://www.creapsoft.co.uk/temp/mail.php.txt), so you can view it.) In turn, this mail.php includes mail.inc.php (again, use mail.inc.php.txt (http://www.creapsoft.co.uk/temp/mail.inc.php.txt) so you can view it) so that its easy to call this easily from within php files - a poor mans subroutine, if you will.
Hope it makes sense.
Edit: About mail.php. It first off checks that the form has at least been filled in. The mail headers contain a wodge of variables (currently set to my email address) which are set up. \r\n is a newline in php.
You'll obviously have to amend mail.php to look like your site, or add a redirect to a page on your site (removing the 'echo' line first)
Thats excellent, thanks.
i've edited the mail example form so that it just includes the email address field, however, how do i format the mail.php and mail.inc.php files so that the mail comes to my email address?
thanks again
Chris Locke
21-08-2005, 20:26
Yes, you'll have to change the mail_from, mail_to, mail_replyTo variables. Otherwise, they'd come to my address, and I'd just delete 'em! :lol:
i know that :p i'm not THAT bad :D
how can i edit them though? and once edited do i just upload them to the main directory?
apologies for all the question BTW
Chris Locke
21-08-2005, 20:36
Download the mail.php.txt and mail.inc.php.txt files, edit them using any text editor, and remove the .txt extensions. Upload to your webspace. Job done.
Technically, the .php files should live in the same directory as your .htm file, but it depends on how your site is laid out. If you have one directory with .php files in, lob them in there, and use relative links in the 'include' to find it. Don't prefix the line with a slash (/) like html files (eg, 'include "/php/mail.inc.php") as that doesn't work with php.
Got it working. Thanks very much for the help :thumbs:
two questions, is there any way i can use a custom .jpg for the submit button instead of the standard submit button, its no big deal but thought i'd ask :D
secondly what do i need to do to get the 'successful message sent' message on a webpage that has my web design on it? basically i'd like it to go to a page that has the website logo and layout on it saying the message has been sent
really appreciate your help BTW
Chris Locke
21-08-2005, 21:07
Either add the page (as you would normally) saying "Email sent" to the end of the mail.php (after the ?> tag) or redirect it (using the normal html meta refresh tag) to an existing page. Depends on how your site is set up now.
As for the submit button, I'm sure you can, but I wouldn't know how. I'm sure its easy to do (find a site that does it, and view the source for the page).
Details here:
http://www.blooberry.com/indexdot/html/tagpages/i/inputimage.htm
:clap: these forums never cease to amaze me.
Thanks everyone for the help, I really appreciate it :)
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.