Why does my webpage not insert data into mysql table?

I'm trying to have a simple webpage with a form to update one cell of my mysql table. I'm not sure why it's not sending the data to my table. I have two webpages. form.php and process.php. Below is the code for each respectively. This is supposed to be working now. I don't get it.

form.php

<!DOCTYPE HTML PUBLIC
<html>
<head>
      <title></title>
 </head>

<body>

<!-- form to get key detail of record in database -->
<form method="POST" action="process.php"> 
<input type="text" name="inputtest" />
<input type="submit" name"submitButton" value="Submit!" /> 
</form> 

</body>
</html>

process.php

<?php
$con=mysqli_connect("localhost","root","Michfball#16","allstate");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

$result = mysqli_query($con,""UPDATE * TO producers
    SET TEST={$inputtest}
    [WHERE ID=1]");
?>
<?php
   $inputtest = $_POST["inputtest"];
?>

Answers


you should define and escape your variable before the update. try this

 $inputtest = mysqli_real_escape_string($_POST["inputtest"]);
 $result = mysqli_query($con,"UPDATE  producers
                              SET TEST= '$inputtest'
                              WHERE ID =1 ");

you code should ne like that

 if(isset($_POST["inputtest"])){
 $inputtest = mysqli_real_escape_string($_POST["inputtest"]);
 $result = mysqli_query($con,"UPDATE  producers
                              SET TEST= '$inputtest'
                              WHERE ID =1 ");
   } 
 else {
  echo "what are you doing here :) ? " ;
    }

Need Your Help

Make alias script failing

macos path applescript alias

Infrequent AppleScript user here, so this may be something incredibly basic, but I can't seem to make an extremely simple script to create a new alias file work. Here's the script in its entirety:...