I need a script made so i can use it as an example that I can use to code other pages with similar needs. I need this today. So bid now if you can do it this NOW!
I have a drop down menu that gets its values from a Mysql database and table called via. What I want to do is once someone chooses the company they want it will give me the phone number and email that is in the database for that company on the same page. here si what I got so far. The menu is getting the Company name form the table but I can not get it to show the specific Company Phone Number and Email for that company. All I can get is the first entry in the table called via. But I need it to change to show the company that is chosen by the dro down menu.
This what I have - I am trying to learn basic things so I need soem help with this..
<?
$dbhost = "localhost";
$dbname = "name";
$dbuser = "user";
$dbpass = "pass";
mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);
$sql="select * from via";
$result=mysql_query($sql);
$zeile = mysql_fetch_array($result);
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<?php
$query5 = "select * from via ORDER BY Customer_Company";
echo "<select name=\"Customer_Company\">";
$result5 = mysql_query($query5);
echo "<OPTION selected>$Customer_Company";
while ($row=mysql_fetch_array($result5))
{
$Customer_Company=$row["Customer_Company"];
echo "<option>$Customer_Company";
}
echo "</select>";
?>
<br />
<input type="submit" name="button" id="button" value="Search by Customer Name" /></form>
//Then I want to have it add to my html page the Phone number and email on the same page below it.//
Customer Phone Number: <?php echo "$zeile[Customer_Phone_Number]" ?>
Customer Email: <?php echo "$zeile[Customer_Email_Number]" ?>
// this entry works but only shows the first record in the table I need it to show the Phone and Email for the company that was selected from the drop down.//
Stephen Bryant