PDA

View Full Version : noob question, how to: php mailer



google
15 Jul 2009, 09:17 AM
Ok i need your help.

I am a bit of a noob in the web realm and i was wondering what is the easiest way to create a php emailer that returns the values from 1. text fields 2. drop down selections 3. radio buttons ... i have created a php mailer that returns the values of text fields but i am unsure of drop downs and radio buttons....

I am using dreamweaver

any advice, easy tutorials etc. would be appreciated..

hpwebsolutions
18 Jul 2009, 09:26 PM
Hi,
Getting the value from a dropdown passed to a PHP script is the same as getting the value from a text input passed to the PHP script. Make sure that in the HTML in the opening select tag you declare a name (ex: <select name="color">). Then give each option a value (ex: <option value="blue">Blue</option>). What PHP will see as the value of $_POST['color'] will be the value of the option selected. If you have a group of radio buttons, give each the same name. Assign them different values.
Example:


<input type="radio" name="sign_up" value="yes_signup" />Yes<br />
<input type="radio" name="sign_up" value="no_signup" />No<br />

In your PHP code, to get the radio button the person selected, use $_POST['sign_up']. If the user selected the first radio, the value of $_POST['sign_up'] would be "yes_signup". You can read more about PHP forms at http://www.w3schools.com/php/php_forms.asp.