0

Hi I want to update my database with a buttonclick, with whats written inside my input value.

$host = "****";
$conn = db2_connect ($host,"*****", "*********");

    <input id='focusedInput' type='text' name='prodinfo' value=''>  
    <button type='submit' class='btn btn-default' value='Byt information's text'>
    </button>

Any suggestions why my update to sql doesnt work? I only get to 'Could not update data msg'

if(isset($_POST['submit']))
{

     if(! $conn ) 
     {
       die('Could not connect: ' . mysql_error());
     }  
    $prodinfo = $_POST['submit'];

    $sql = "UPDATE Persons ". "SET Hobby = $prodinfo". 
           "WHERE Id = 99999" ;

    $retval = mysql_query( $sql, $conn );

    if(! $retval ) {
    die('Could not update data: ' . mysql_error());
     }
    echo "Updated data successfully\n";

    mysql_close($conn);

    }   
JoJo
  • 29
  • 6

0 Answers0