0

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
2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by diafol
1

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
0

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 ?

Edited by accra: n/a

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.