new2coding Posted September 26, 2012 Share Posted September 26, 2012 I am working on a project to supply information about a location based on a drop down selection. I was able to to load all of the locations using the following code: <?php require_once('database.php'); $query = "SELECT * FROM COLO_INFO ORDER BY COLO"; $colos = $db->query($query); ?> Then in the HTML portion: <tr> <td> <select name="colo"> <?php foreach ($colos as $colo) : ?> <option><?php echo $colo_name['COLO']; ?></option> <?php endforeach; ?> </select> </td> My problem is I cannot figure out how to make the other data to change with the drop box selection. I only seem to be able to get a static response in there. Example is I'm trying to put the Address data from my table based on the users selection. The header for that column is PHYSICAL_ADDR. I'm very new to PHP so I still only have very basic knowledge. Thank you for any assistance you can give. Eng_toolbox.php Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 26, 2012 Share Posted September 26, 2012 If you want the data to change without reloading the page, that's ajax. If you're just asking how to select based on the user's selection, with a page reload, you'd put that select box in a form, use $_POST to get the variable, then put it in the WHERE clause. Quote Link to comment 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.