What I'm trying to do is select once from the dropdown and use the selection
to update the 'numbersdb' database via the submit button. This is current code. No message, no results. Thanks for your help.
<?php
$dbconnect = mysqli_connect('localhost','root','');
mysqli_select_db($dbconnect, 'numbersdb') or die( "Unable to select database");
$taxrate = (isset($_POST['submit'])) ? mysqli_real_escape_string($dbconnect, $_POST['taxrate']) : '';
$id = (isset($_POST['id'])) ? mysqli_real_escape_string($dbconnect, $_POST['id']) : '';
$result = mysqli_query($dbconnect, "SELECT * FROM numbdata");
if (!empty($_POST['update_taxrate'])) {
$update = mysqli_query($dbconnect, "UPDATE numbdata SET taxrate = '$taxrate' WHERE id ='$id'");
echo "Taxrate has been set ...";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Select taxrate</title>
<style type="text/css">
body {
background: #cff;
}
form {
text-align: center;
}
</style>
</head>
<body>
<form name="taxset" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<p><label>Select state/rate</label><p>
<select name="taxrate">
<option value="0.04000" selected>4% Alabama</option>
<option value="0.05600">5.6% Arkansas</option>
</select>
</p>
<!--<p><label>Update taxrate</label>
<input type="text" name="update_taxrate">-->
<p><input type="submit" name="submit" value="update"></p>
</form>
</body>
</html>
following is the print view of "numdata" database.
Rows: 1
id taxrate bank receiptno
1 0.575 475.25 127