Quickfix99
Technical User
I have some code that populates a list box from a database. I am trying to assign the value of the list box to a variable when the user clicks on a button. For some reason, my code does not set the variable. Any ideas? Here is the code I am using:
<?php
require("phpsqlajax_dbinfo.php");
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
$connection=mysql_connect (localhost, $username, $password);
if (!$connection) { die('Not connected : ' . mysql_error());}
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
$query="SELECT fullname FROM deceased ORDER BY fullname";
$result = mysql_query ($query);
echo "<select name=\"Deceased\">";// Start list box
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[fullname]>$nt[fullname]</option>";
}
echo "</select>";// Closing of list box
$select = $_POST['select'];
$chooser = $_POST['Deceased'];
echo($chooser.'<br><br>');
?>
<form action="testphp.php5" method="POST" >
<p><input type="Submit" name="Select" value="select" /></p>
</form>
</body>
</html>
Thanks,
QF
<?php
require("phpsqlajax_dbinfo.php");
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
$connection=mysql_connect (localhost, $username, $password);
if (!$connection) { die('Not connected : ' . mysql_error());}
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
$query="SELECT fullname FROM deceased ORDER BY fullname";
$result = mysql_query ($query);
echo "<select name=\"Deceased\">";// Start list box
while($nt=mysql_fetch_array($result)){
echo "<option value=$nt[fullname]>$nt[fullname]</option>";
}
echo "</select>";// Closing of list box
$select = $_POST['select'];
$chooser = $_POST['Deceased'];
echo($chooser.'<br><br>');
?>
<form action="testphp.php5" method="POST" >
<p><input type="Submit" name="Select" value="select" /></p>
</form>
</body>
</html>
Thanks,
QF