Posted by David Haynes on 12/18/66 11:50
amit wrote:
> Hello group,
>
> I have switched to linux and PHP so totally new to this field. Please
> help me with my question. I have an HTML code which contains a
> drop-down control on it using
> <select name=selected_group>
> <option> Gropu 1</option>
> <option> Group 2</option>
> and ...
> </select>
> <?php
> $group = $_POST['selected_group'];
> ?>
>
> meantime, I'm my php code using $group = $_POST['selected_group'] but
> nothing will assinged to the $group variable. I tried different html
> codes which were on web for learning purpose but didn't work out!
> please let me know if you have any suggestions.
>
> Thanks,
> Amit
>
The value of 'selected_group' is only assigned to the $_POST value when
the form submit action is invoked and the form is using a POST method.
So:
1. is your <select> within a <form>?
2. does the <form> have method="POST"?
3. does the <form> also contain an <input type="submit"> or onchange= to
the select?
If not, $_POST['selected_group'] will not be set and $group will be empty.
-david-
[Back to original message]
|