php dynamic drop down menue picking values from data-base
i am using following code to insert data into mysql database
<?php
$refselect = $_POST['refselect'];
$refname = $_POST['refname'];
$refemail = $_POST['refemail'];
$refcnt = $_POST['refcnt'];
$refdes = $_POST['refdes'];
$开发者_如何学运维referror = $cberror = "<h1>Data not Added</h1><br/><br/><h3>Please Follow The Instructions</h3>";
$urefdb = "INSERT INTO refdb(reftype,refname,refemail,refcnt,refdes) VALUES ('$refselect','$refname','$refemail','$refcnt','$refdes');";
include_once("db.php");
if ($refselect == "Select Type") die ("$referror");
if (empty ($refname)) die ("$referror");
if (mysql_query("$urefdb"))
{
echo "<h3>One Record Updated Successfully with the following Details </h3><br/>";
echo "Reference Type =$refselect <br/><br/>";
echo "Reference Name = $refname <br/><br/>";
echo "Reference E-Mail = $refemail <br/><br/>";
echo "Reference Description = $refdes <br/><br/>";
}
else
{
echo mysql_error();
}
?>
"refselect" data is coming from a drop down menu at the page now i want that as i add data through this form another form located at another page pic "refname" from database as i update "refdb" that drop down menu pick data accordingly
what to do now ?
To update the values of another form by changing a select's value, you need to learn about javascript's "onchange" event.
精彩评论