How do I fetch data from table into dropdown menu in mysql and post back to another table? What I want is to create a registration form for customers and attach an agent to each customer, the agent names are stored in a table and i need to post agent name back when am sumitting the customers details.
see code below.
<?php
if(isset($_POST['submit'])){
$agent_dat1=$_POST['Company_Name'];
$agent_dat2=$_POST['First_Name'];
$agent_dat3=$_POST['Other_Name'];
$agent_dat4=$_POST['Software'];
$agent_dat5=$_POST['Version'];
$agent_dat6=$_POST['Agent'];
$agent_dat7=$_POST['City'];
$agent_dat8=$_POST['State'];
$agent_dat9=$_POST['Agent_Email'];
$agent_dat10=$_POST['Agent_Phone'];
$insert= "INSERT INTO `capdata`.`agent`(`Company_Name`,`First_Name`,`Other_Name`,`Software`,`Version`,`Agent`,`City`,`State`,`Agent_Email`,`Agent_Phone`) VALUES ('$agent_dat1','$agent_dat2','$agent_dat3','$agent_dat4','$agent_dat5','$agent_dat6','$agent_dat7','$agent_dat8','$agent_dat9','$agent_dat10');";
$result = mysql_query($insert, $connection);
// execute the SQL statement
if ($result) {
echo "Congratulations <b> $_POST[Company_Name] </b> your Registration is successful!";
} else {
echo "Sorry! User Registration Fail";
}
}
?>
Please i would appreciate a little help here.