I have been struggling with a way to get my dropdown menu working correctly.
I think passing the variables is my main problem. Here is what I have:
<select name="company" onChange="MM_jumpMenu('parent',this,0)">
<option selected>- Click Here -</option>
<?php
include 'config.php';
/*** create a new mysqli object with default database***/
$connection = mysqli_connect($hostname, $username, $password, $dbname) or die ("Unable to connect");
//create query
$sql = "SELECT id, comp_name FROM company";
//excute query
$result = mysqli_query($connection, $sql) or die ("Error in query: $sql. ".mysqli_error());
while(list($id, $comp_name) = mysqli_fetch_array($result))
{
echo "<option value=phone_ext.php?id=$id>$comp_name</option>";
}
// close connection
mysqli_close($connection);
?>
</select>
I'm using the post command to pass the variable to the other page. Here is what my query reads on the redirected page:
//create query
$query = "SELECT comp_name, comp_address, comp_city, comp_state, comp_zip,
comp_tollfree, comp_phone, comp_fax, comp_website, comp_nightbell FROM company where id = '" . $_POST['id'] . "'";
When I jump to my other page it is completely blank. Don't understand that at all.
Thanks for any help you can provide.
A