|
Answer» 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. Thanks for your HELP. Code: [Select]<?php $dbconnect=mysqli_connect('localhost','root',''); mysqli_select_db($dbconnect,'numbersdb')ordie("Unabletoselectdatabase"); $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*FROMnumbdata"); if(!empty($_POST['update_taxrate'])){ $update=mysqli_query($dbconnect,"UPDATEnumbdataSETtaxrate='$taxrate'WHEREid='$id'"); echo"Taxratehasbeenset..."; } ?>[/color] Code: [Select][color=red]<!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="<?phpecho$_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> [/color]
|