Skip to content Skip to sidebar Skip to footer

Passing Value From A Dropdown List From One Php To Another

I have A dropdown list populated from a MySQL table. A button. Another php page What I need to do: On clicking the button, pass the value selected from the dropdown list as a va

Solution 1:

By wrapping the drop down in a form with POST method, you can send the value to the next page and retrieve via $_POST['your_field_name']. See the docs.

Solution 2:

Your page1 will have a form something like

<formaction="page2.php"method="post"><p>Name: <inputtype="text"name="name" /></p><p><inputtype="submit" /></p></form>

And in page2.php you can do something along the lines of

$name = $_POST['name'];
$sql  = "SELECT * FROM table WHERE name LIKE '$name'";
...

(But make sure to scrub the user input before using it on page2.php!)

Solution 3:

you will need javascript to do this. The page already finish loading. php script wont work after page finish loading. try jquery, ez to use

Post a Comment for "Passing Value From A Dropdown List From One Php To Another"