|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi there,
I am trying to find out how to send form data from my website back to me (using a 'submit' button) either via email or to a database and where I put this coding in relation to the actual form coding. Here is my form coding: <link href="mainform.css" type="text/css" rel="stylesheet" /> <div id="form"> <h2 align="left">Feedback Form</h2> <p><span style="FONT-SIZE: 14pt">Please fill out the form below to pass on your query. If you have any urgent questions, don't hesitate to </span><a href="index.php?p=1_46"><span style="FONT-SIZE: 14pt">contact us</span></a> <span style="FONT-SIZE: 14pt">.</span></p> <form action="feedback.php" method="post"> <p class="legend"><strong><span style="FONT-SIZE: 14pt">Personal information</span></strong></p> <fieldset id="personal"> <label>Name:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" size="30" name="name" /><br /> <label>Address:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" size="30" name="address" /><br /> <label>Town/City:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" size="30" name="city" /><br /> <label>State:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" maxlength="3" size="3" name="state" /><br /> <label>Postcode:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" maxlength="5" size="5" name="postcode" /><br /> <label>Phone:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" maxlength="10" size="10" name="phone" /><br /> <label>Email:</label> <input style="BACKGROUND-COLOR: rgb(255,255,160)" size="40" name="email" /><br /> </fieldset> <p class="legend"><strong><span style="FONT-SIZE: 14pt">Choices</span></strong></p> <fieldset id="choices"> <p id="querytype"> <label>Type of Query:</label> <select name="querytype"> <option value="Compliment">Compliment</option> <option value="Suggestion">Suggestion</option> <option value="Complaint">Complaint</option> <option value="Question">Question</option> </select></p> <p id="size"> <label>Size:</label> <input type="radio" value="'F" name="size" ?? />Freestyle Aerobics <input type="radio" value="W" name="size" />Wedding Dance <input type="radio" value="'D" name="size" ?? />Dance <input type="radio" value="M" name="size" />Music Editing <input type="radio" value="T" name="size" />Translation </p> <p id="extras"> <label>Extras:</label> <input type="checkbox" value="salsa" name="extras[]" />Salsa <input type="checkbox" checked="checked" value="zouk" name="extras[]" />Zouk <input type="checkbox" value="hiphop" name="extras[]" />Hip Hop <input type="checkbox" value="instructorworkshops" name="extras[]" />Instructor Workshops <br /> </p></fieldset> <p class="legend"><strong><span style="FONT-SIZE: 14pt">Suggestions</span></strong></p> <fieldset id="suggestions"> <style type="text/css"> <!-- textarea.html-text-box {background-color:ffffff;background-repeat:no-repeat;background-attachment:fixed;border-width:1;border-style:solid;border-color:cccccc;font-family:Arial;font-size:8pt;color:0000FF;} input.html-text-box {background-color:ffffff;font-family:Arial;font-size:8pt;color:000000;} --> </style> <textarea class="html-text-box" name="comments" rows="10" cols="100">Enter your comments here...></textarea><br /> </fieldset> <p id="buttons"> <input type="submit" value="Submit" /> <input type="reset" value="Start Over" /></p> <fieldset></fieldset> </form></div> I have saved 'feedback.php' to my remote root folder. ANyway, hopefully someone can help. If you can, please be as precise as possible, as I am not a wiz at this stuff. Thanks heaps in advance!! Terry |
|
||||
|
You put the action coding inside feedback.php. First you get the form parameters using for example:
$name = $_POST["name"]; etc... Where the name inside the $_POST is the name you gave to the input tag in your form. You can then program as necessary to either e-mail it to yourself (using the PHP mail function for example) or save it on a database. Not sure how much you know about PHP but the place to start learning is: PHP Tutorial and if you are already familiar with some programming in PHP, full details of the language can be found at: PHP: PHP Manual - Manual |
|
|||
|
I spend time a the Kirupa site for flash stuff, but they have php articles and I found this article that does exactly what you are looking for.
kirupa.com - PHP Contact Form |
|
|||
|
Hi terrymckinven,
This may not directly apply to the question of getting a form handler in place, but it is worth giving heed to the controls that are handing user information over to the handler. Even if there are no technical errors, the quality of your form will have an impact on how much it is used, and on the reliability of the information that is passed along from the user. Valid, accessible, semantic markup is the key to ensuring the user and you get the most from web input. Permit me to pick at the code above, just a little... Hopefully the Code:
<link href="mainform.css" type="text/css" rel="stylesheet" /> Code:
<style>. LABEL is intended to describe a corresponding form control, as in Code:
<label for="querytype">Query Type</label> <select name="querytype" id="querytype"> <option /> <option /> </select> When no FOR= attribute is included, the LABEL tag refers only to its own contents, so <label>Something</label> ends up being a label for nothing, and has no explicit ties to adjacent controls. If one wishes to use the tag in this manner, then wrap the control, as in, Code:
<label>Options: <select><option /><option /></select></label> Code:
<label><select><option /><option /></select> Options</label> Empty FIELDSET elements, like most empty elements may cause validation errors, or at least TIDY errors. The old "no empty divs' rule more or less applies across the board. An exception to this would be if the element had an id= attribute intended to let Javascript identify it while generating scripted content, as in Code:
<div id="menu"></div> The jury may be out on the RESET button, but from an accessibility standpoint, it can lead to confusion or frustration on the part of the user. It becomes more frustrating the longer the form if one accidentally clicks the wrong button. The probability a frustrated user will refill a long form is practically nil. Something to consider. If the user really wants to start over all they need do is re-enter the page. Where multiple selections are available, you may wish to include MAKE SELECTION, NONE SELECTED or DOES NOT APPLY as an option, then preselect it. If the user sends the form without making a choice, it won't be misleading to the person reading the information. ++++++++++++++++++ Can we assume that FEEDBACK.PHP is your form handler? If so you may wish to insulate it from the main root of your site and stash it in a restricted folder protected from prying eyes with .htacess and robots.txt. It may do well to disguise the name a little too, but this is something you will need to research. Be sure the form handler (action="FORM_HANDLER") is configured to send output to a valid recipient, preferably on the same domain as the web form (for added credibility and 'trustworthy' replies). It follows that one might expect a reply from info+xyz.com if that's the domain from which they submitted the form. A reply from joe4567+hotmail.com will just look like spam. It's noble that you're getting right to it, designing a powerful form, though I would recommend starting with a simple feedback form with name, e-mail and text message. This will give you a chance to get things working without all the fine details getting the way. Cheers!
__________________
Volunteer for something in your community today! |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Send form data with PHP | kurt.santo | Web Programming Discussion Forum | 13 | 01-13-2008 03:54 PM |
| Passing form data to remote form on another site | webace | Graphics & Design Discussion Forum | 8 | 08-31-2007 03:21 AM |
| Form data to PDF | Tim | Web Programming Discussion Forum | 15 | 04-28-2007 01:51 AM |
| Posting form data from a script | newmarket | Web Programming Discussion Forum | 3 | 07-19-2005 02:49 AM |
| Pre-populating an HTML Form with Data from Another HTML Form | ambassador | Web Programming Discussion Forum | 3 | 06-19-2005 09:12 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |