help w/mysqli

Hi guys, Please advise me here. The following code is a recent attempt at mysqli. It doesn’t update

[code]

    <html>
       <head>
         <title>Select taxrate</title><br>
          <style  
            body
          { background: #ccffff; }
           form
          { text-align: center; }
         </style>
       </head>
    <body>
       <form name="form" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
         <p><label>Select state/rate</label><br>              
           <select name="taxrate">
             <OPTION class=highlight value=0.04000 selected>4% - Alabama
              <OPTION class=highlight value=0.00000>no tax- ALASKA  
               <OPTION class=highlight value=0.00056>5.6%- Arizona
             </SELECT><p>       
  if(isset($_POST['submit']))
     { $taxrate = $_POST['taxrate']; } 
     $dbconnect = mysqli_connect('localhost','root','');
               <input type="submit" name="update_taxrate" value="submit"><p>
         </form></body></html[/code]>

[php]
<?php
mysqli_select_db($dbconnect, ‘oodb’) 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 numbers”);
if (!empty($_POST[‘update_taxrate’]))
{ $update = mysqli_query($dbconnect, “UPDATE numbers SET taxrate = ‘$taxrate’ WHERE id =’$id’”);
echo “Taxrate has been set …”; }
?>[/php]

I don’t see anywhere in HTML where you will actually have a value for

[php]$_POST[‘id’][/php]

Therefore you are updating a blank ID which probably doesn’t exist and that’s why nothing is updating.

Sponsor our Newsletter | Privacy Policy | Terms of Service