Jump to content

[SOLVED] Putting a HTML variable into $_Get


Kodak07

Recommended Posts

I want  to put the value of my drop down list into a PHP $_GET variable:

This is the html code

<form action="insert.php" method="post">
<select name="users">
<option value="user1">user1</option>
<option value="user2">user2</option>
<option value="user3">user3</option>

 

how do i put the value into $_GET["q"] and pass it to my php page that runs a query?

 

Link to comment
https://forums.phpfreaks.com/topic/48541-solved-putting-a-html-variable-into-_get/
Share on other sites

When the form is submitted all the values from the form will be, in this case, in the $_POST superglobal array. The value selected from the dropdown list will be in $_POST['users']. Once your script starts, you can do anything you want with it. Why are you asking about $_GET["q"]?

 

Ken

Logically, to get the 'q' in the $_GET array, edit your form as below:

<form action="insert.php" method="get">
<select name="q">
<option value="user1">user1</option>
<option value="user2">user2</option>
<option value="user3">user3</option>
</select>
<input type="submit" value="Go"/>
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.