I get values from an HTML form using a post method and store them in my DB through the mysql INSERT command (done in PHP).
something like this:
$value = $_POST['name'];
$value1 = $_POST['age'];
$sql = "INSERT INTO table(name,age) VALUES('$value','$value1')" ;
Now what I want to do is I want to give a link in the same PHP file like:
echo '<A HREF="http://xxx.com/rascal.php/">To update just entered info click on me</a>';
Now the rascal.php as mentioned in the link above also contains the same form fields (name and age).
The values stored in the database through the INSERT command above should be fetched from the DB and placed in the respective form field area (name and age should be stored in their respective forms of rascal.php).
How can I do this?
Here it is:
This should work if you change ‘table’ to your table name. You should be happy, because I wrote the entire code for you. Please show it.
Further advice: Make sure your code is save by passing all input variables through a mysql_real_escape_string() function. Add an id field (unique key, self incrament) to your database table so you can select records based on their id’s and not some other field (The code I provided only works if you don’t have more entries with the same name).
There are some great php tutorials here.