Category: Client & Server Side Scripting (PHP, ASP, JavaScript)
PHP Email Form checkboxes: HTML, CSS, JavaScript, PHP
I have this php file which shows a form on the page for the user to fill in. It then sends the results to my email. There are some check boxes on there which once checked display in the subject of my email. I would like the result of the checkbox to appear in the message like the rest of the information but cant figure out what to do. The code is attached below.
Thanks for your help
Carly
<?
# Main File. Feedback Mailer. v 1.01
#
# Author: hpnadig
# Last modified on Jan 2004.
#
# copyright 2004, hpnadig. http://hpnadig.com/index.php?pg=scripts
#
# You can use, redistribute the script provided that the author name and credits are maintained
# intact. If you make any changes, I'd be glad if you can inform me about that... and I'll include
# it in the next version of the script with, ofcourse, due credits. So, please do inform me at
# hpnadig@gmail.com,
# along with the diff.
#
# modified by donie
# addition : cookies for form values, website field, easy to integrate with website, and valid XHTML 1.0 trans
#
#################################################################################################### ##
# version 1.01
# CONFIGURATION
# Title of the Page
$title = 'Feedback Mailer v1.0 beta';
# Subject prefix for the mail arriving in your Mail Box... eg. [hpnadig.com-feedback]
$sub = '[Subject-Prefix]';
# The Mail address you want the mail to be sent to...
$address = 'carly@cjpltd.co.uk';
# The Mail address(es) you want to be included in the BCC list...
$ccmail = 'alternative@yourmail.com'; // $ccmail = ''; if you dont want use CC
# The Mail address(es) you want to be included in the BCC list...
$bccmail = 'alternative2@yourmail.com'; // $bccmail = ''; if you dont want use BCC
# Error Messages... edit them to your needs :)
$errors['name'] = "No Name Entered!";
$errors['email'] = "Need proper mail - id";
$errors['website'] = "Need proper website address";
$errors['comments'] = "Please type in your comments!";
$errors['subject'] = "No Subject Selected!";
# error reporting, and misscellany__________________________________________________________ #
// if there is no 'http://' on website field
if ( substr ($website, 0, 7) != "http://") {
$url = "http://" . $website;
}
else {
$url = $website;
} // done!
if($formsent) { echo ("<div align=\"center\" style=\"padding: 0px;\"><font color=\"#E96B10\">Thank you very much <b>$name</b> for the feedback!<br /> The Message has been despatched.</font><br /></div><div align=\"center\" style=\"border-bottom: 1px solid #CCC;\"><br /></div>"); }
else { echo ("<div align=\"center\" style=\"padding: 0px;\"><font color=\"#E96B10\">Dear <b>$name</b>, There was a bit of problem - which means, the form <b>hasn't been sent!</b>. Try again... </font><br /></div><div align=\"center\" style=\"border-bottom: 1px solid #CCC;\"><br /></div>"); }
}
}
}
// end of checking
?>
<br />
<?php
if(!$formsent) { // if the email has not been sent, will display message above and form below
?>
<b>Where did you hear about Young Group? </b><br />
<textarea name="find" cols="30" rows="8" class="input"><?php echo "$findc"; ?></textarea>
<br />
<b>Select the subject*</b><br />
<input type="checkbox" name="subject_pre[]" value="Feedback" /> Feedback on the Site <br />
<input type="checkbox" name="subject_pre[]" value="Other" /> Other <br />
<?php
}// if the email has been sent, will display thank you message above and links below
else {
echo "<a href=\"javascript: history.go(-1)\">back</a> | <a href=\"http://www.yoursite.com\">Home</a><br />";
}
?>
</div></div></div><br />
</body>
</html>
Hello,
Get your code precised so that it might help others to help you.