Reply to Re: HTML and PHP question (not assinging any value)

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация