How do I create an easy to use web form? |
![]() ![]() |
How do I create an easy to use web form? |
Jul 28 2006, 09:35 PM
Post
#1
|
|
|
GeekU Senior Posts: 636 From: New Zealand OS: Microsoft Windows XP Home Edition |
I would like to create an easy to code web form. Could anyone help me? I just need it for like feedback etc. Would it be possible for it to send the data to an e-mail address? Thankyou for your help, ~Matt This post has been edited by Matt T: Dec 16 2007, 09:49 PM |
|
|
Jul 29 2006, 03:20 AM
Post
#2
|
|
![]() Member ![]() ![]() ![]() Posts: 327 From: Zagreb, Croatia OS: Windows XP HE |
you need to use a server scripting technology such as php. here's an example form and script to go with it.
CODE <form action="mail.php" method="post"> E-mail: <input type="text" name="email"> First name: <input type="text" name="firstname"> <br> Last name: <input type="text" name="lastname"> Input/feedback: <textarea rows="10" cols="30" name="feedback"> Enter feedback here </textarea> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form> as you can see, along with every input it is mandatory to use the name attribute. this is how the php will get the variables- the names become the names of the variables. CODE <html> <body><?php //send email $email = $_REQUEST['email']; $subject = site feedback; $feedback = $_REQUEST['feedback']; $firstname = $_REQUEST['firstname']; $lastname = $_REQUEST['lastname']; $message = "$firstname $lastname sends you the following message \n $message"; mail( "you@yoursite.com", "Subject: $subject", $message, "From: $email" ); //message displayed on the user's screen echo "Thank you for using our mail form"; ?> </body> </html> i haven't tested it, however i wouldn't give this to u if i didn't think it works. test it, post the results (if any). there's a form section in www.w3schools.com's html tutorial, and a php mail section in its php tutorial. This post has been edited by TaNkZ101: Jul 29 2006, 03:25 AM |
|
|
Jul 29 2006, 03:02 PM
Post
#3
|
|
![]() I SPAMMED Too Much! ![]() ![]() ![]() Posts: 905 From: Southwater, West sussex, UK OS: Windows Xp Home edition |
|
|
|
Jul 29 2006, 05:44 PM
Post
#4
|
|
|
GeekU Senior Posts: 636 From: New Zealand OS: Microsoft Windows XP Home Edition |
Thankyou TaNkZ101, I tried what you suggested and Firefox said the file wasn't found because I couldn't get notepad to save it with a .php extenstion it put it as blahblah.php.txt. I went to the site that you reccomended w3schools.com and I didn't really understand the site.
Thankyou Allsortshop, I tried that website link and it was very informative. I set all the files up on my websever but because it is free it doesn't support php (great) and this message comes up: You have accessed a filetype or folder that must be served from a CGI server. This means that this file may exist, but if the site isn't upgraded for CGI, it cannot be served. To avoid this message, do not name your files with a .php, .cgi, or .pl extension, and don't store them in a folder named cgi-bin. Does anyone know of a way to get around this or to get the script to automatically e-mail it to me preferbly without having to use the persons mail program (I know I am picky). Thanks you guys for your help, ~Matt This post has been edited by Matt T: Dec 16 2007, 09:50 PM |
|
|
Jul 30 2006, 02:43 AM
Post
#5
|
|
![]() Member ![]() ![]() ![]() Posts: 327 From: Zagreb, Croatia OS: Windows XP HE |
you can use asp to do it, but if your server doesn't support php i doubt it supports asp. or maybe cgi? i don't know. if your server doesn't support scripting, then if you HAVE to have the contact/feedback form, you could use html's "mailto:" function, or pick another host (www.free-webhosts.com has a database, including what they offer.)
here is an example with the form's 'mailto' attribute. Beware, it is supposedly extremely unreliable. CODE <html>
<body> <form action="MAILTO:you@yoursite.com" method="post" enctype="text/plain"> <h3>This form sends an e-mail to W3Schools.</h3> Name:<br> <input type="text" name="name" value="yourname" size="20"> <br> Mail:<br> <input type="text" name="mail" value="yourmail" size="20"> <br> Comment:<br> <textarea rows="10" cols="30" name="feedback"> Enter feedback here </textarea> <br><br> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form> </body> </html> |
|
|
Jul 30 2006, 10:46 PM
Post
#6
|
|
|
GeekU Senior Posts: 636 From: New Zealand OS: Microsoft Windows XP Home Edition |
Thankyou TaNk101,
I'll try that free web host that you reccomended. I have tried a html script just like the one you posted, but the reason I don't want to use a script like that is because the person who was sending feedback would have to have a mail program and an account set up with it. I could use it though if nothing else worked. This post has been edited by Matt T: Dec 16 2007, 09:51 PM |
|
|
![]() ![]() |
Similar Topics
| Topic Title | Replies / Views | Topic Information | |||||
|---|---|---|---|---|---|---|---|
![]() |
1 / 349 | 23rd October 2005 - 06:01 AM smpkge started - last by dsm |
|||||
![]() |
1 / 617 | 21st March 2007 - 06:18 AM gotmtn started - last by Keith |
|||||
![]() |
3 / 438 | 31st March 2008 - 07:54 AM Elisamark started - last by ScHwErV |
|||||
![]() |
7 / 341 | 20th October 2008 - 10:00 AM SkyLogic started - last by SRX660 |
|||||
|
Time is now: 7th January 2009 - 10:50 AM |
| Advertisements do not imply our endorsement of that product or service. The forum is run by volunteers who donate their time and expertise. We make every attempt to ensure that the help and advice posted is accurate and will not cause harm to your computer. However, we do not guarantee that they are accurate and they are to be used at your own risk. |