Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Fixing a php form processor

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Fixing a php form processor

Postby ircreative » Thu Jan 02, 2014 11:05 am

Hi, I have a php form processor that I like using but I can't get the checkbox array/implode for the processor work. I would also like it to go to a website page after it's submitted. Right now all it says is a generic "thank you" message and lets the user know they can close the window.

(In the form html I have the checkbox area written as:
<input type="checkbox" name="field_name[]" value="ValueHere">&nbsp;ChoiceGoesHere<br>

If I could at least get help with making the checkbox stuff work that would be great. Thanks much. If this is something that should be in jobs instead of asking for help here I can post it there instead.

Code: Select all
<?php

/* Subject and Email Variables */

   $emailSubject = 'Form Subject Here';
   $webMaster = 'email address to send form to here';

/* Gathering Data Variables */


   $actnameField = $_POST['actname'];
   $contactnameField = $_POST['contactname'];
   $phoneField = $_POST['phone'];
   $cellphoneField = $_POST['cellphone'];
   $faxField = $_POST['fax'];
   $emailField = $_POST['email'];
   $websiteField = $_POST['website'];
   $facebookField = $_POST['facebook'];
   $grouptypeField = implode(', ', $POST['grouptype']);
   $othergrouptypeField = $_POST['othergrouptype'];
   $musictypeField = implode(', ', $POST['musictype']);
   $othergenretypeField = $_POST['othergenretype'];
   $actdescriptionField = $_POST['actdescription'];
   $photoavailableField = $_POST['photoavailable'];
   $videoavailableField = $_POST['videoavailable'];
   $audioavailableField = $_POST['audioavailable'];
   $vampire = $_POST['vampire'];
   $pastdatesField = $_POST['pastdates'];
   $currentdatesField = $_POST['currentdates'];
   $homecityField = $_POST['homecity'];
   $traveldistanceField = $_POST['traveldistance'];
   $performancefeeField = $_POST['performancefee'];
   $performancelengthField = $_POST['performancelength'];
   $commentsField = $_POST['comments'];


/* REQUIRED FIELDS VALIDATION */

if ($_POST['actname']=="") {
Print("The ACT NAME field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['contactname']=="") {
Print("The CONTACT NAME field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['phone']=="") {
Print("The ACT NAME field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['email']=="") {
Print("The EMAIL field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['grouptype']=="") {
Print("The GROUP TYPE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['musictype']=="") {
Print("The MUSIC TYPE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['actdescription']=="") {
Print("The ACT DESCRIPTION field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['photoavailable']=="") {
Print("The PHOTO AVAILABLE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['videoavailable']=="") {
Print("The VIDEO AVAILABLE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['audioavailable']=="") {
Print("The AUDIO AVAILABLE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['pastdates']=="") {
Print("The PAST PERFORMANCE DATES field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['currentdates']=="") {
Print("The CURRENT PERFORMANCE DATES field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['homecity']=="") {
Print("The HOME CITY field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
if ($_POST['traveldistance']=="") {
Print("The TRAVEL DISTANCE field is required.  Please click the BACK button and complete that field.  Thank you!<br>");
exit();
}
else
{
echo "Your information has been submitted.  Thank you for contacting us.  We will contact you after we have reviewed your information.";
echo "<BR><BR>";
echo "Please <a href='http://www'>Click here</a> to return to the True North Entertainment website.";
}


/* CODING FOR HOW THE DATA WILL LOOK IN THE EMAIL */

   $body = <<<EOD
<br><hr><br>
<strong>Act Name:</strong> $actnameField <br><br>
<strong>Contact Name:</strong> $contactnameField <br><br>
<strong>Phone Number:</strong> $phoneField <br><br>
<strong>Cell Number:</strong> $cellphoneField <br><br>
<strong>Fax Number:</strong> $faxField <br><br>
<strong>Email Address:</strong> $emailField <br><br>
<strong>Website Address:</strong> $websiteField <br><br>
<strong>Facebook Address:</strong> $facebookField <br><br>
<strong>Group Type:</strong> $grouptypeField <br><br>
<strong>Other Group Type:</strong> $othergrouptypeField <br><br>
<strong>Music Genre:</strong> $musictypeField <br><br>
<strong>Other Music Genre Type:</strong> $othergenretypeField <br><br>
<strong>Act Description:</strong> $actdescriptionField <br><br>
<strong>Photo Available:</strong> $photoavailableField <br><br>
<strong>Video Available:</strong> $videoavailableField <br><br>
<strong>Audio Available:</strong> $audioavailableField <br><br>
<strong>Are they a Vampire:</strong> $vampireField <br><br>
<strong>Past Dates Available:</strong> $pastdatesField <br><br>
<strong>Upcoming Dates Available:</strong> $currentdatesField <br><br>
<strong>Home City:</strong> $homecityField <br><br>
<strong>Travel Distance:</strong> $traveldistanceField <br><br>
<strong>Performance Fee:</strong> $performancefeeField <br><br>
<strong>Performance Length:</strong> $performancelengthField <br><br>
<strong>Comments:</strong> $commentsField <br><br>
EOD;

   $headers = "From: $emailField\r\n";
   $headers .= "Content-type: text/html\r\n";
   $success = mail($webMaster, $emailSubject, $body, $headers);

/* Results rendered as HTML */



?>
ircreative
New php-forum User
New php-forum User
 
Posts: 1
Joined: Thu Jan 02, 2014 10:51 am

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.