Another noob question here. I've got a form that I use to collect info for an estimate. I also am using Developer toolbox from Adobe. Makes my life a lot easier, but doesn't teach you anything. lol
Originally I had a drop down box that would hold the value of selected item and post it into to emailTO field. Which worked just fine.
Example:
//This is my array.
$emails_array = array(
'Landscape Maintenance'=>'
[email protected]',
'Landscape Design'=>'
[email protected]',
'Planting Renovation'=>'
[email protected]',
'Tree Service'=>'
[email protected]',
'Weed Man Lawn Fertilization'=>'
[email protected]',
'Snowplowing'=>'
[email protected]',
'Other'=>'
[email protected]');
//This grabs the post of the drop down box and inserts the email addy.
$emailObj->setTo($emails_array[$_POST['Services']]);
Now I have to change the drop down box to a check box group. In which the user can select multiple services and have multiple email sent out if necessary. This is where I'm stuck. I need to get the post values compare the results to the key in $emails_array then spit out the email associated with it.
Here's what I got so far.
$postresult = $_POST['services'];
echo 'Postresult: ' . "$postresult" . "<br />";
$myarray = explode(",", $postresult);
echo 'Dirty Array: ';
print_r($myarray);
Here are the results
Postresult: Landscape Maintenance,Tree Service,Snowplowing<br>
MyArray: Array
(
[0] => Landscape Maintenance
[1] => Tree Service
[2] => Snowplowing
)
How do I take either $postresult OR $myarray and compare it to $emails_array and get the unique email values for it? I want to maintain the original $postreault so i can insert it into a mysql db.
Here is the code Developer toolbox produces for the checkbox group.
<form method="post">
<label>
<input type="submit" name="Submit" id="Submit" value="Submit">
<input name="services" id="services" wdg:recordset="Recordset1" wdg:subtype="CommaCheckboxes" wdg:type="widget" wdg:displayfield="service" wdg:valuefield="service" wdg:groupby="2" style="display: none; "><span><table cellpading="0" cellspacing="0" border="0"><tbody><tr><td><label id="services_label0" htmlfor="services_commacheckbox0" for="services_commacheckbox0"><input type="checkbox" id="services_commacheckbox0" value="Landscape Maintenance" cbFor="services">Landscape Maintenance</label></td><td><label id="services_label1" htmlfor="services_commacheckbox1" for="services_commacheckbox1"><input type="checkbox" id="services_commacheckbox1" value="Landscape Design" cbFor="services">Landscape Design</label></td></tr><tr><td><label id="services_label2" htmlfor="services_commacheckbox2" for="services_commacheckbox2"><input type="checkbox" id="services_commacheckbox2" value="Planting Renovation" cbFor="services">Planting Renovation</label></td><td><label id="services_label3" htmlfor="services_commacheckbox3" for="services_commacheckbox3"><input type="checkbox" id="services_commacheckbox3" value="Tree Service" cbFor="services">Tree Service</label></td></tr><tr><td><label id="services_label4" htmlfor="services_commacheckbox4" for="services_commacheckbox4"><input type="checkbox" id="services_commacheckbox4" value="Weed Man Lawn Fertilization" cbFor="services">Weed Man Lawn Fertilization</label></td><td><label id="services_label5" htmlfor="services_commacheckbox5" for="services_commacheckbox5"><input type="checkbox" id="services_commacheckbox5" value="Snowplowing" cbFor="services">Snowplowing</label></td></tr><tr><td><label id="services_label6" htmlfor="services_commacheckbox6" for="services_commacheckbox6"><input type="checkbox" id="services_commacheckbox6" value="Other" cbFor="services">Other</label></td><td colspan="2"> </td></tr></tbody></table></span>
</label>
</form>
I would appreciate any help on this. thank you.