QuickForm array processing
| From: | Poncho Pilate | Date: | Wed, 17 Aug 2005 04:06:16 +0000 |
| Subject: | QuickForm array processing | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-20438@lists.php.net to get a copy of this message | ||
This might be a dumb question, but humour me please.
I'm having trouble inserting data from the Date element and hierarchial select. Everything in my form is cool, except that I understand that the submitted data would be an array for these elements, but how do I access them for database insertion?
Some info:
$dobOpts = array('language' => 'en',
'format' => 'd M Y',
'minYear' => date('Y'),
'maxYear' => date('Y')-80);
$form->addElement('date', 'dob', 'Date of birth:', $dobOpts);
$sel =& $form->addElement('hierselect', 'location', 'Location:');
$sel->setOptions(array($locations,$regions,$areas));
$form->setDefaults(array(
'dob'=>array('d'=>$row['dob_day'],'M'=>$row['dob_month'],'Y'=>$row['dob_year']),
'location'=>array($row['country']-1,$row['region']-1,$row['area']-1),
'email'=>$row['email']
));
$form_result = $form->getSubmitValues();
$sql="UPDATE org_user SET
dob_day='".$form_result['dob']['d']."',
dob_month='".$form_result['dob']['M']."',
dob_year='".$form_result['dob']['Y']."',
country='".($form_result['location'][0]+1)."',
region='".($form_result['location'][1]+1)."',
area='".($form_result['location'][2]+1)."',
email='".$form->getSubmitValue('email')."'
WHERE
user_id ='".$form_result['user_id']."'";
Everything is being inserted into the DB with no problems except the date and location information.
Any help would be great, thanks.
Mark