RE: [PHP] HTTP_GET_VARS[]
| From: | Matt Schroebel | Date: | Thu, 30 Jan 2003 17:53:51 +0000 |
| Subject: | RE: [PHP] HTTP_GET_VARS[] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-133673@lists.php.net to get a copy of this message | ||
> >> $query = "UPDATE assets SET title = '$title', version =
> >> '$version',
> >> developer = '$developer', serial_number = '$serial_number', WHERE
> >> asset_id = '$HTTP_GET_VARS[id]'" ;
> >
> > Change the var to '{$HTTP_POST_VARS['id']}' (with the curly braces
> > since
> > the array reference is inside a double quoted string. If
> your version
> > of php is 4.1.2 or higher, you really ought to use '{$_POST['id']}'
> > since it's a magic global and easier to use since you won't have to
> > declare it global inside functions.
My bad, I misunderstood what you meant. Yes, you'll need to save the id
from the get, and put it in a hidden field on the form or in a session
var, and use that in the update. Still, make sure to wrap the array
reference in curly braces inside the double quoted string.