Jump to content

I'm a newbie so be gentle....


txhoyt

Recommended Posts

I'm simply using a php to submit a very simple form via email.

Everything is working fine except that I can't get the form to submit multiple check boxes with the same name.  It keeps sending only the last check box in the list that is selected.

 

I've stripped out just one of the form check box elements so you can get a sense of what I'm talking about

 

Form code:

 

<form id="form_info_request" name="form_info_request" method="post" action="/php/contactjst.php">

<label for="information">What design service are you interested in?</label>
<br />

<span class="form_text">
<input name="information" type="checkbox" class="boxes" tabindex="11" value="Funeral Home Design" /> 
Funeral Home Design<br />

<input name="information" type="checkbox" class="boxes" tabindex="12" value="Interior Design" /> 
Interior Design<br />

<input name="information" type="checkbox" class="boxes" tabindex="13" value="Mausoleum Design" /> 
Mausoleum Design<br />

<input name="information" type="checkbox" class="boxes" tabindex="14" value="Cemetery Planning" /> 
Cemetery Planning<br />

<input name="information" type="checkbox" class="boxes" tabindex="15" value="Visualization Services" /> 
Visualization Services<br />

<input name="information" type="checkbox" class="boxes" tabindex="16" value="Other Services" /> 
Other Services</span><br />

<input name="other_services" type="text" class="form_left_margin" id="other_services" tabindex="17" />
<br /><br />

<input name="submitbutton" type="submit" id="submitbutton" value="Submit" tabindex="31" />
<input name="resetbutton" type="reset" id="resetbutton" value="reset" tabindex="32" />
</form>

 

 

PHP I'm using:

<?php 
$to = "[email protected]";
$from = $_REQUEST['email'] ; 
$name = $_REQUEST['name'] ; 
$headers = "from: $from"; 
$subject = "Website Information Request Submission"; 

$fields = array(); 
$fields{"name"} = "Name"; 
$fields{"company"} = "Company";
$fields{"title"} = "Title";
$fields{"email"} = "Email Address";
$fields{"phone"} = "Phone Number";
$fields{"web"} = "Web Address";
$fields{"street"} = "Street Address";
$fields{"city"} = "City";
$fields{"state"} = "State";
$fields{"zipcode"} = "Zipecode";
$fields{"information"} = "More information";
$fields{"develop"} = "Develop a";
$fields{"find_us"} = "Found JST via";
$fields{"comments"} = "Additional Comments"; 

$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } 

$headers2 = "From: [email protected]"; 
$subject2 = "Thank you for contacting us"; 
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.me.com.  Please do not reply to this message.";

if($name == '') {print "You have not entered a name, please go back and try again";} 
else { 
if($from == '') {print "You have not entered an email, please go back and try again";} 
else { 
$send = mail($to, $subject, $body, $headers); 
$send2 = mail($from, $subject2, $autoreply, $headers2); 
if($send) 
{header( "Location: http://www.me.com" );} 
else 
{print "We encountered an error sending your mail, please notify [email protected]"; } 
}
}
?>

 

 

Any help you can give me I would greatly appreciate.

 

 

Link to comment
https://forums.phpfreaks.com/topic/191805-im-a-newbie-so-be-gentle/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.