using QuickForm with $_GET variable for default id - when it processes there is no variable in URL so it throws error

From: Date: Tue, 04 Jan 2005 15:26:36 +0000
Subject: using QuickForm with $_GET variable for default id - when it processes there is no variable in URL so it throws error
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16587@lists.php.net to get a copy of this message
I need a URL var so I use the $_GET to get the ID I need. I use that ID to do a db query to get the user Name for the form. When the form processes, it apparently looks again for the &$_GET vcar and, since it' not there, throws an error and never gets to the actual processing of the form. Here's the firs par tof the form: <?php session_start(); require_once("DB.php"); require_once 'HTML/QuickForm.php'; require('db_connectivity'); //get ID $ID = ((get_magic_quotes_gpc()) ? $_GET['ident'] : addslashes($_GET['ident'])); if (!is_numeric($ID)) { $locID = $_SESSION['L_ID']; header("Location: ../?c=$L_ID"); // exit; } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Testing PEAR HTML_QuickForm</title> </head> <body> <?php $form = new HTML_QuickForm('new', 'post'); //get class title $sql = 'SELECT lName FROM user WHERE U_ID = ' . $ID . ''; $res = $db->query($sql); if (DB::isError($res)) { die($res->getMessage()); } $row =& $res->fetchRow(); $facName = $row[0]; $form->addElement('html',"<tr><td>New User:</td><td><b>$facName</b></td></tr>"); .... element definition ... if ($form->validate()) { $form->process('process_data', false); //true means the form has a file to be uploaded header("Location: ../home.php"); exit; } function process_data ($values) { var_dump($values); //for testing purposes } __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

« previous php.pear.general (#16587) next »