note 21333 added to language.variables.predefined
| From: | dibby at dibby dot com | Date: | Wed, 08 May 2002 21:26:50 +0000 |
| Subject: | note 21333 added to language.variables.predefined | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30356@lists.php.net to get a copy of this message | ||
Just a quick note incase anyone comes across the same problem.
Basic problem results from the new superglobals and having globals set to off: basic form that shows
a record from database, on submit updates the record.
The problem comes with validating the data, i.e. user enteres a non suitable value and you throw
back the form and the error.
When you pull the data from the database, the values are not in the $_POST or $_GET super globals,
thus using $_POST[var] as initial value for form field doesnt work.
Using $some_var as initial is fine, but if the user enteres an improper value, those values wont be
available because they are then in $_POST or $_GET.
The solution is simple, but it escaped me for a bit because I didnt think it would be possible: you
can actually defined $_POST members within a script, thus your values from the database should be
converted to $_POST or $_GET members.
Hope it helps someone.
--
http://www.php.net/manual/en/language.variables.predefined.php
http://master.php.net/manage/user-notes.php?action=edit+21333
http://master.php.net/manage/user-notes.php?action=delete+21333
http://master.php.net/manage/user-notes.php?action=reject+21333