Jump to content

Including array values in a form email


bukwus

Recommended Posts

Hi

 

I've created a form that includes check boxes. Here's a couple examples of the code:

 

<input type="checkbox" name="category[]" value="Accounting" /> Accounting<br />
<input type="checkbox" name="category[]" value="Administration" /> Administration<br />

 

I'm trying to include the checked values of the array "category[]" with the rest of the form's info in an email that results when the form is filled out correctly. Here's the PHP I'm using to handle the email. I've placed ??? where I'm having the trouble:

 

$to = 'email@company.org';
$email_subject = 'ExpertNet Aplicant';
$email_body = "Name: ".$_POST['firstName'] . $_POST['lastName']."\n
Title: ".$_POST['title']."\n
Email: ".$_POST['email']."\n
Company: ".$_POST['company']."\n
Company Description: ".$_POST['description']."\n
Address: ".$_POST['address1']."\n
Address: ".$_POST['address2']."\n
City: ".$_POST['city']."\n
State: ".$_POST['state']."\n
Zip Code: ".$_POST['zip']."\n
Phone#: ".$_POST['phone']."\n
Fax#: ".$_POST['fax']."\n
Web Address: ".$_POST['web']."\n
Categories Chosen: "???" \n
Other: ".$_POST['other'];
$headers = "From:" .$_POST['email'];

//Place variables in mail funciton
mail($to, $email_subject, $email_body, $headers);

 

Hope this makes sense.

Many thanks,

Andy

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.