Hellow, I have the following issue if you please can help me. I have this index.php file:
<html><body><h1>It works!</h1><form action="/PHP/update.php" method="post">Age: <input type="text" name="age"><input type="submit"></form><?php//connecting to database//$con=mysqli_connect("localhost","root","gogonea","my_db"); // conection checking//if (mysqli_connect_errno())//{// echo "conection failed ".mysqli_connect_error();//}//else//{//echo "Ghiata, conection established! <br>";//} function afi(){include("displaytable.php");}//afi(); //closing connection//mysqli_close($con);?><div><p>cucu</p><form name="displaytable" action="\PHP\displaytable.php" method="get"><input type="submit" value="Display Table"></form> </div></body></html>
And this update.php file:
<?php//connecting to database$con=mysqli_connect("localhost","root","gogonea","my_db"); //conection checkingif (mysqli_connect_errno()){ echo "conection failed ".mysqli_connect_error();}else{echo "Ghiata, conection established! <br>";} //Updating Tablemysqli_query($con,"UPDATE Persons SET Age=ageWHERE FirstName='Peter' AND LastName='Griffin'"); //closing connectionmysqli_close($con); ?>
I can't update the age, taked from the form scripted in the index.php This is a test of how to take values from forms and transmit them to a database. If I wasn't exprimed clear please tell me to be more explicite if is the case. Thank you verry much