Hello,
I'm new to phpbuilder and php in general. I'm working through two books currently, "Begining PHP5 from Novice to Professional" and "Essential PHP Tools" both by Apress.
If you could please help me move forward.
My current project is a PHP form using PEAR's HTML_QuickForm that will insert some data fields into mysql and generate an email containing all the submitted form data.
My problem is how can I print the values for the following code in my email?
<snip>
//add phone number grouping
$phone[] = &HTML_QuickForm::createElement('text','areacode',null,'size="3"');
$phone[] = &HTML_QuickForm::createElement('text','exchange',null,'size="3"');
$phone[] = &HTML_QuickForm::createElement('text','last4',null,'size="4"');
$form->addGroup($phone,'phone_number','Phone: ','-');
$form->addGroupRule('$phone','Enter Phone Number','required');
</snip>
Once the form is submitted I want HTML_Quickform to validate and then generate the email.
<snip>
// pull form data into $data variable
$data = $form->getSubmitValues();
if ($form->validate()) {
$msg = "Registration Form \n \n";
$msg .= "Client Name:\t$data[first_name] $data[last_name]\n";
$msg .= "Client Email:\t$data[email]\n";
$msg .= "Client Phone:\$data[phone_number]";
...
</snip>
As you can see below I get back 'array' instead of any of the values for the array.
Client Name: t Jordan
Client Email: tim@pcs-alaska.com
Client Phone: Array
I understand that the getSubmittedValue() puts the form variable into the $data variable. I'm stuck on understanding how you pull the values from array's like the example above when I want to print them in emails.
Thank you very much for any input you can provide.
Tim