Sunday, 21 May 2017

php - How do I obtain the value of the option that was chosen in a select from?

In the PHP code below I have created a form that is used to create a drop down list.




echo "";
echo "
";
echo "

Agency Network

";
echo "
";
echo "";
echo "";
echo "
";
echo "
";
?>



This code works as desired. It populates a drop down list based on the results of a database query. After the form has been submitted, I want to obtain the option that was selected and use it in another query. After the submit, I print the contents of the $_POST variable using:



print_r($_POST);


and my results are as follow:
Array ( [network] => [submit] => Send )




I want to get the value that was selected for network but it appears to be blank. Can anyone tell me what I'm doing wrong.



By the way, I am really new at coding and this is my first time using SO so please excuse any usage errors on my part. Thanks.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...