Jump to content

Trouble Making A Drop Box Work Properly


new2coding

Recommended Posts

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

Link to comment
Share on other sites

:code_tags:

 

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.