update value is not changing
I have my hidden id
<input type="hidden" name="id" value="<?php echo "$id" ?>" />
in my form
I have my
$id = $_REQUEST['id'];
to get the id from the url
And on the update script i have
$navtype = $_GET['nav'];
And i have
WHERE id=$id
, but it keep updating just one record over and over,no matter which record i select.
When i make the hidden text, i see the right id
<input type="text" name="id" value="<?php echo "$id" ?>" />
.
I echo
"$sql";
, and the value is always one
UPDATE persoz SET lname='Daniel',fname='Ekow Gilbert Jr.',p_no='012012',todate='2011-01-01', WHERE id=1
accra
Junior Poster in Training
70 posts since Jan 2011
Reputation Points: 11
Solved Threads: 2
I'm a bit confused. You're using a form to send the id, by you say that it's coming from the url. Do you have a method attribute in the form tag? The default is get, but it's usually taken that form data should be sent by post. Also, don't use $_REQUEST - it's not very secure (cookies, post and get can use it - you should use the specific type).
Firstly:
UPDATE persoz SET lname='Daniel',fname='Ekow Gilbert Jr.',p_no='012012',todate='2011-01-01', WHERE id=1
is wrong - there should not be a comma before the WHERE clause.
UPDATE persoz SET lname='Daniel',fname='Ekow Gilbert Jr.',p_no='012012',todate='2011-01-01' WHERE id=1
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
I'm a bit confused. You're using a form to send the id, by you say that it's coming from the url. Do you have a method attribute in the form tag? The default is get, but it's usually taken that form data should be sent by post. Also, don't use $_REQUEST - it's not very secure (cookies, post and get can use it - you should use the specific type).
Firstly:
UPDATE persoz SET lname='Daniel',fname='Ekow Gilbert Jr.',p_no='012012',todate='2011-01-01', WHERE id=1
is wrong - there should not be a comma before the WHERE clause.
UPDATE persoz SET lname='Daniel',fname='Ekow Gilbert Jr.',p_no='012012',todate='2011-01-01' WHERE id=1
I did just that,replace the comma,but no result.
Are you saying i should use $_GET in place of $_REQUEST ?
accra
Junior Poster in Training
70 posts since Jan 2011
Reputation Points: 11
Solved Threads: 2
Depends on how you're sending the form data. $_GET or $_POST don't use $_REQUEST. However, I can't see how that would sort out the $id value though. Post the whole code snippet.
diafol
Rhod Gilbert Fan (ardav)
7,800 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080