QuickForm: how do you use the same form for EDIT and NEW records?
| From: | l Burnerheimerton | Date: | Mon, 22 Aug 2005 19:48:26 +0000 |
| Subject: | QuickForm: how do you use the same form for EDIT and NEW records? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20522@lists.php.net to get a copy of this message | ||
I'm almost ready to throw my hands up. I'm not new to
quickforms but I am creating some new forms and
running into problems.
If the form is meant to create a new record, I send it
a URL variable, "newRec". If it's editing a record,
the form is sent the URL variable, "editRec".
I call:
$form = new HTML_QuickForm('record', 'POST',
$_SERVER['PHP_SELF'] . '?' .
$_SERVER['QUERY_STRING']);
If it's edited, some defaults are set but that's
really the main difference.
It is blowing up when it processes the form. It wants
some parameters but not getting them.
Here's what I use to check each parameter:
if (isset($_GET[$param1])) {
if (strcmp($_GET[$param1], (int)$_GET[$param1]) == 0)
{
$arr[$param1] = (int)$_GET[$param1];
} else { // if it's not a number, log them out of the
system
$m = "The URL does not contain the correct
parameter. ";
header("Location:
ErrorPage.php?m=".base64_encode($m));
exit;
}
}
Any ideas? If you have SIMPLE examples of forms used
to process BOTH edit and new records, please post. Thanks!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com