I’m trying to understand mysql in combination with php, and just tried to create a form
to update something in the database.
I’m getting the old value in as parameter which has to be changed.
Which i place in a field to be edited. As soon as i press the button a query has to run that
updated the old value to the new one.
Suppose you have the following code:
<?php
$oldvalue = $_REQUEST['value'];
?>
<form action="change.php">
<input type="text" name="newvalue" value="<?= $oldvalue ?>">
<input type="submit" value="send">
</form>
The oldvalue in the field can be changed now and once the button is submitted, I want to run the query:
UPDATE test SET value='$newvalue' WHERE value='$oldvalue'
The problem is: how to send the oldvalue along with the form? So that i can run the query in change.php
Thanks!
Put the old value in a hidden input: