Web form retrieve <select><option> with PHP
I am either very stupid or very very tired but I cannot quite understand how to retrieve data from a web form if the data is in a <select> box. The data is being sent via email.
PHP is VERY new to me. I have managed to understand this syntax :
$surname = $_POST['surname']
and this has led to :
$body = "First Name:$firstname\n surname:$surname\n E-Mail:$email\n address:\n$address\n" ;
My web form is emailed perfectly. I need now to get data from :
I don't understand how to refer to this in my php. It's almost as though <select> should have an id. <select name="choice"> ??
Hmmm! I am really tired. :o I don't know if my question even makes sense. I love it when I am completely in the dark.
Thanks in advance!!!!!
You need to add the name attribute then the selected item will be returned in the $_POST array with the name being the key.
I reread my post this morning and kicked myself (twice.) I had answered myself. Many thanks graemef : your response confirmed everything for me. It works!!
Now I need to understand how to report an error if a registrant does not tick a specific box.
Simple things sometimes takes massive leaps of understanding.
|All times are GMT -5. The time now is 05:06 PM.|