Hi There,
Im really really pulling my hair out here, and was hoping you guys could help a really poor coder!
basically, I have a table with a list of contracts in it, and a table with a list of applications for each contract.
I can succesfully populate a list box with the contract name by using the following:
<form action="routing.php" action="post">
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("callrouting") or die(mysql_error());
$query="SELECT * FROM contracts";
$result = mysql_query($query);
echo '<select name="contract" onchange="this.form.submit()">';
while($nt=mysql_fetch_array($result)){
$name = $nt['name'];
echo '<option value="' . $name . '">' . $name . '</option>';
}
echo '</select>';
echo '</form>';
?>
However it doesnt do anything, it just takes me the routing.php page, its supposed to take to the routing page, but populated with all the fields from the selected contract in the listbox...
Here is the function thats supposed to do it:
//this is the function that retrieves the contract information, static at the moment, will be added a form or list box
function listcontract(){
//get the form data
//$selectedcontract= $_POST['contract'];
//end form data
$getcontract= "select * from contracts WHERE name = 'Gatwick'";
$results = mysql_query($getcontract);
while($row = mysql_fetch_array($results))
{
echo "<div id='header'>";
echo "<h1>" .$row['name']." Call Routing Table </h1>";
echo "</div>";
echo "<div id='recordholder'>";
echo "<div id='title'>" .$row['name'] ." Contract Information</div>";
echo "<div id='logo'><img src='images/" .$row['logo']."' /><br /><span class='address'>".nl2br($row['address']) ."</span></div>";
echo "<div id='address'>" . $row['servicenumber'] . "<br />" .$row['servicemailbox'] ."<br /><br /><span class='description'>" .$row['description']."</span></div>";
echo "</div>";
echo "<br clear='all' />";
echo "<br />";
}}
as you can see Ive commented out the code and entered the contract name manually because its not working..
would really appreciate some help