Liamsorsby Posted November 26, 2010 Share Posted November 26, 2010 Is there a way to use a html form and a dropdown menu to INSERT data into a mysql database for example can get the form to submit but then i want to use the dropdown menu to be the different tables in the mysql database. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/219912-php-with-drop-downboxes/ Share on other sites More sharing options...
eo92866 Posted December 7, 2010 Share Posted December 7, 2010 this is simply my idea.... first create two different html/php pages one that will be the list for your users to utilize the drop downs next one that will have the redirect information. first page that will be for your users aka htmlSelection.php <html> <body> <form action="dropdownResults.php" method="POST" name="links"> <select name="dropdown" value="options"> <option value"htmlSelection.php">Select Format</option> <option value="directory/yourTitle1.php">Your Title 1</option> <option value="directory/yourTitle2.php">Your Title 2</option> </select> <br/> <br/> <input type="submit" value="Submit Query"/> </body> </html> second page that will be for your redirect aka... dropdownResults.php <?php $drop = $_REQUEST['dropdown']; if ($drop ='Your Title 1') header("Location: yourTitle1.php".$row["your Title 1"]); elseif ($drop ='Your Title 2') header("Location: yourTitle2.php".$row["Your Title 2"]); ?> now what you want to do is place your mysql code at the top of "Your Title 1 or 2" .php files that connects/queries/closes the mysql db. read here... http://www.w3schools.com/PHP/php_mysql_connect.asp Quote Link to comment https://forums.phpfreaks.com/topic/219912-php-with-drop-downboxes/#findComment-1144177 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.