PHP - Having Trouble W/ Checkboxes On Contact Form
Hello!
Everything on this form emails the way it should except for the checkboxes. The email simply states "Array" instead of what services are checked off. I don't understand PHP that well so I used a contact form and tried to modify it to include the checkboxes. Didn't work out Please help. <?php // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE! $yourEmail = "hello@mail"; // the email address you wish to receive these mails through $yourWebsite = ""; // the name of your website $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4 $requiredFields = "name,email,comments"; // names of the fields you'd like to be required as a minimum, separate each field with a comma // DO NOT EDIT BELOW HERE $error_msg = null; $result = null; $requiredFields = explode(",", $requiredFields); foreach($_POST["service"] as $value) { $service .= "$value\n"; } function clean($data) { $data = trim(stripslashes(strip_tags($data))); return $data; } function isBot() { $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz"); foreach ($bots as $bot) if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") return true; return false; } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isBot() !== false) $error_msg .= "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT']; // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam $points = (int)0; $badwords = array("adult", "beastial", "bestial", "blowjob", "clit", "cum", "cunilingus", "cunillingus", "cunnilingus", "cunt", "ejaculate", "fag", "felatio", "fellatio", "fuck", "fuk", "fuks", "gangbang", "gangbanged", "gangbangs", "hotsex", "hardcode", "jism", "jiz", "orgasim", "orgasims", "orgasm", "orgasms", "phonesex", "phuk", "phuq", "pussies", "pussy", "spunk", "xxx", "viagra", "phentermine", "tramadol", "adipex", "advai", "alprazolam", "ambien", "ambian", "amoxicillin", "antivert", "blackjack", "backgammon", "texas", "holdem", "poker", "carisoprodol", "ciara", "ciprofloxacin", "debt", "dating", "porn", "link=", "voyeur", "content-type", "bcc:", "cc:", "document.cookie", "onclick", "onload", "javascript"); foreach ($badwords as $word) if ( strpos(strtolower($_POST['comments']), $word) !== false || strpos(strtolower($_POST['name']), $word) !== false ) $points += 2; if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false) $points += 2; if (isset($_POST['nojs'])) $points += 1; if (preg_match("/(<.*>)/i", $_POST['comments'])) $points += 2; if (strlen($_POST['name']) < 3) $points += 1; if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500)) $points += 2; // end score assignments foreach($requiredFields as $field) { trim($_POST[$field]); if (!isset($_POST[$field]) || empty($_POST[$field])) $error_msg .= "Please fill in all the required fields and submit again.\r\n"; } if (!preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name']))) $error_msg .= "The name field must not contain special characters.\r\n"; if (!preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) $error_msg .= "That is not a valid e-mail address.\r\n"; if (!empty($_POST['url']) && !preg_match('/^(http|https):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(\d+))?\/?/i', $_POST['url'])) $error_msg .= "Invalid website url.\r\n"; if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Automatic Form Email"; $message = "You received this e-mail message through your website: \n\n"; foreach ($_POST as $key => $val) { $message .= ucwords($key) . ": " . clean($val) . "\r\n"; } $message .= "\r\n"; $message .= 'IP: '.$_SERVER['REMOTE_ADDR']."\r\n"; $message .= 'Browser: '.$_SERVER['HTTP_USER_AGENT']."\r\n"; $message .= 'Points: '.$points; if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) { $headers = "From: $yourEmail\n"; $headers .= "Reply-To: {$_POST['email']}"; } else { $headers = "From: $yourWebsite <$yourEmail>\n"; $headers .= "Reply-To: {$_POST['email']}"; } if (mail($yourEmail,$subject,$message,$headers)) { if (!empty($thanksPage)) { header("Location: $thanksPage"); exit; } else { $result = 'Thank You! Your email was successfully sent.'; $disable = true; } } else { $error_msg = 'Your mail could not be sent this time. ['.$points.']'; } } else { if (empty($error_msg)) $error_msg = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']'; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Contact Us</title> <meta charset="utf-8"> <link rel="stylesheet" href="css/reset.css" type="text/css" media="all"> <link rel="stylesheet" href="css/style.css" type="text/css" media="all"> <script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="js/cufon-yui.js"></script> <script type="text/javascript" src="js/Humanst521_BT_400.font.js"></script> <script type="text/javascript" src="js/Humanst521_Lt_BT_400.font.js"></script> <script type="text/javascript" src="js/cufon-replace.js"></script> <script type="text/javascript" src="js/roundabout.js"></script> <script type="text/javascript" src="js/roundabout_shapes.js"></script> <script type="text/javascript" src="js/gallery_init.js"></script> <!--[if lt IE 7]> <link rel="stylesheet" href="css/ie/ie6.css" type="text/css" media="all"> <![endif]--> <!--[if lt IE 9]> <script type="text/javascript" src="js/html5.js"></script> <script type="text/javascript" src="js/IE9.js"></script> <![endif]--> </head> <body> <!-- header --> <header> <div class="container"> <h1><a href="index.html"></a></h1> <nav> <ul> <li><a href="index.html">Home</a></li> <li><a href="aboutpg/about.html">About</a></li> <li><a href="currentpg/current.html">Current</a></li> <li><a href="contact.php" class="current">Contact</a></li> </ul> </nav> </div> </header> <!-- #gallery --> <section id="gallery"> <div class="container"> <ul id="myRoundabout"> <li><img src="images/postcard.jpg"></li> </ul> </div> </section> <!-- /#gallery --> <div class="main-box"> <div class="container"> <div class="inside"> <div class="wrapper"> <!-- aside --> <aside> <h2>Contact <span></span></h2> <!-- .contacts --> <ul class="contacts"> <li><strong>Owner:</strong></li> <li><strong>Business:</strong></li> <li><strong>Address:</strong></li> <li><strong> </strong></li> <li><strong>Phone:</strong></li> <li><strong>Email:</strong> <script type="text/javascript"> /*<![CDATA[*/ /*********************************************** * Encrypt Email script- Please keep notice intact * Tool URL: http://www.dynamicdrive.com/emailriddler/ * **********************************************/ <!-- Encrypted version of: [at] *****.*** //--> var emailriddlerarray=[83,80,87,105,110,99,55,55,64,121,97,104,111,111,46,99,111,109] var encryptedemail_id20='' //variable to contain encrypted email for (var i=0; i<emailriddlerarray.length; i++) encryptedemail_id20+=String.fromCharCode(emailriddlerarray) document.write('<a href="mailto:'+encryptedemail_id20+'"></a>') /*]]>*/ </script></li> </ul> <!-- /.contacts --> <h3>Miscellaneous info:</h3> <p><a href="http://www.fireislandferries.com" target="_blank">Fire Island Ferries</a></p> <p><a href="http://www.googlemaps.com" target="_blank">Google Maps</a></p> <p><a href="http://www.fireislandnews.net" target="_blank">Fire Island News</a></p> <p><a href="http://www.fireislandtide.net" target="_blank">Fire Island Tide</a></p> </aside> <!-- content --> <section id="content"> <article> <h2><span>*All fields are required.</span></h2> <?php if ($error_msg != NULL) { echo '<p class="error">ERROR: '. nl2br($error_msg) . "</p>"; } if ($result != NULL) { echo '<p class="success">'. $result . "</p>"; } ?> <form action="<?php echo basename(__FILE__); ?>" method="post"> <noscript> <p><input type="hidden" name="nojs" id="nojs" /></p> </noscript> <label>Services Required (check off as many as required):</label> <br> <input type="checkbox" name="service[ ]" id="service_0" value="addition" align="right">Addition<br> <input type="checkbox" name="service[ ]" id="service_1" value="remodeling">Remodeling<br> <input type="checkbox" name="service[ ]" id="service_2" value="roof">Roof<br> <input type="checkbox" name="service[ ]" id="service_3" value="foundation">Foundation<br> <input type="checkbox" name="service[ ]" id="service_4" value="kitchen">Kitchen<br> <input type="checkbox" name="service[ ]" id="service_5" value="bath">Bath(s)<br> <input type="checkbox" name="service[ ]" id="service_6" value="tile">Tile Work<br> <input type="checkbox" name="service[ ]" id="service_7" value="window">Windows<br> <input type="checkbox" name="service[ ]" id="service_8" value="deck">Deck<br> <input type="checkbox" name="service[ ]" id="service_9" value="painting">Painting<br> <input type="checkbox" name="service[ ]" id="service_10" value="power washing">Power Washing<br> <input type="checkbox" name="service[ ]" id="service_11" value="opening closing">Spring Opening/Fall Closing <br><br> <br /> <p> <small>Name: </small><input type="text" name="name" id="name" value="<?php get_data("name"); ?>" size="22" placeholder="First Last"/> <label for="name"></label> </p> <p> <small>Phone: </small><input type="text" name="email" id="email" value="<?php get_data("phone"); ?>" size="22" placeholder="(123) 123-4567"/> <label for="phone"></label> </p> <p> <small>Email: </small><input type="text" name="email" id="email" value="<?php get_data("email"); ?>" size="22" placeholder="you@email.com"/> <label for="email"></label> </p> <p> <small>Message: </small><textarea name="comments" id="comments" placeholder="Please write a brief message here."><?php get_data("comments"); ?></textarea> <label for="comments" style="display:none;"></label> </p> <p> <input name="submit" type="submit" id="submit" value="Submit Form" <?php if (isset($disable) && $disable === true) echo ' disabled="disabled"'; ?> /> </p> </form> </div> </article> </section> </div> </div> </div> </div> <script type="text/javascript"> Cufon.now(); </script> </body> </html> Similar Tutorials(php is a weakness)
Here is the HTML portion for the form:
<form action="send_form_email.php" id="contacts-form" method="post"> Hello, I have coded a contact form in PHP and I want to know, if according to you, it is secure! I am new in PHP, so I want some feedback from you. Moreover, I have also two problems based on the contact form. It is a bit complicated to explain, thus, I will break each of my problem one by one. FIRST:The first thing I want to know, is if my contact form secure according to you: The HTML with the PHP codes: Code: [Select] <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { //Assigning variables to elements $first = htmlentities($_POST['first']); $last = htmlentities($_POST['last']); $sub = htmlentities($_POST['subject']); $email = htmlentities($_POST['email']); $web = htmlentities($_POST['website']); $heard = htmlentities($_POST['heard']); $comment = htmlentities($_POST['message']); $cap = htmlentities($_POST['captcha']); //Declaring the email address with body content $to = 'alithebestofall2010@gmail.com'; $body ="First name: '$first' \n\n Last name: '$last' \n\n Subject: '$sub' \n\n Email: '$email' \n\n Website: '$web' \n\n Heard from us: '$heard' \n\n Comments: '$comment'"; //Validate the forms if (empty($first) || empty($last) || empty($sub) || empty($email) || empty($comment) || empty($cap)) { echo '<p class="error">Required fields must be filled!</p>'; header ('refresh= 3; url= index.php'); return false; } elseif (filter_var($first, FILTER_VALIDATE_INT) || filter_var($last, FILTER_VALIDATE_INT)) { echo '<p class="error">You cannot enter a number as either the first or last name!</p>'; return false; } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo '<p class="error">Incorrect email address!</p>'; return false; } elseif (!($cap === '12')){ echo '<p class="error">Invalid captcha, try again!</p>'; return false; } else { mail ($to, $sub, $body); echo '<p class="success">Thank you for contacting us!</p>'; } } ?> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"> <p>Your first name: <span class="required">*</span></p> <p><input type="text" name="first" size="40" placeholder="Ex: Paul"/></p> <p>Your last name: <span class="required">*</span></p> <p><input type="text" name="last" size="40" placeholder="Ex: Smith"/></p> <p>Subject: <span class="required">*</span></p> <p><input type="text" name="subject" size="40" placeholder="Ex: Contact"/></p> <p>Your email address: <span class="required">*</span></p> <p><input type="text" name="email" size="40" placeholder="Ex: example@xxx.com"/></p> <p>Website:</p> <p><input type="text" name="website" size="40" placeholder="Ex: http//:google.com"/></p> <p>Where you have heard us?: <span class="required">*</span></p> <p><select name="heard"> <option>Internet</option> <option>Newspapers</option> <option>Friends or relatives</option> <option>Others</option> </select></p> <p>Your message: <span class="required">*</span></p> <p><textarea cols="75" rows="20" name="message"></textarea></p> <p>Are you human? Sum this please: 5 + 7 = ?: <span class="required">*</span></p></p> <p><input type="text" name="captcha" size="10"/></p> <p><input type="submit" name="submit" value="Send" class="button"/> <input type="reset" value="Reset" class="button"/></p> </form> SECOND PROBLEM:If a user has made a mistake, he gets the error message so that he can correct! However, when a mistake in the form occurs, all the data the user has entered are disappeared! I want the data to keep appearing so that the user does not start over again to fill the form. THIRD: When the erro message is displayed to notify the user that he made a mistake when submitting the form, the message is displaying on the top of the page. I want it to appear below each respective field. How to do that? In JQuery it is simple, but in PHP, I am confusing! I have read around and can't seem to find the right coding for what I need on this forum and some other other forums. I have a contact form (as listed below) and I need 2 locations (Print Name and Title) fields to auto-populate on a separate form (can be a doc, pdf, etc. any form of document which is easiest) and this form can be totally back end and the individual using the form never is going to see the form. It's going on a contract form, that we would like to auto-populate. Also is there a simple attachment code so individuals can attach documents to the code? <p style: align="center"><form action="mailtest.php" method="POST"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <div align="center"> <p class="style1">Name</p> <input type="text" name="name"> <p class="style1">Address</p> <input type="text" name="address"> <p class="style1">Email</p> <input type="text" name="email"> <p class="style1">Phone</p> <input type="text" name="phone"> <p class="style1">Debtor</p> <input type="text" name="debtor"> <p class="style1">Debtor Address</p> <input type="text" name="debtora"> <br /> <br /> <a href="authoforms.php" target="_blank" style="color:#ffcb00" vlink="#ffcb00">Click here to view Assignment Agreement and Contract Agreement</a> <p class="style1"><input type='checkbox' name='chk' value='I Have read and Agree to the terms.'> I have read and agree to the Assignment and Contract Agreement <br></p> <p class="style1">Print Name</p> <input type="text" name="pname"> <p class="style1">Title</p> <input type="text" name="title"> <p class="style1">I hear by agree that the information I have provided is true, accurate and the information I am submitting is <br /> not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms:</p> <select name="agree" size="1"> <option value="Agree">Agree</option> <option value="Disagree">Disagree</option> </select> <br /> <br /> <p class="style1">Employee ID:</p> <input type="text" name="employee"> <br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </div> </form> </p> The mailtest php is this ?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $name = $_POST['name']; $address = $_POST['address']; $email = $_POST['email']; $phone = $_POST['phone']; $debtor = $_POST['debtor']; $debtora = $_POST['debtora']; $value = $_POST['chk']; $pname = $_POST['pname']; $title = $_POST['title']; $agree = $_POST['agree']; $employee = $_POST['employee']; $formcontent=" From: $name \n Address: $address \n Email: $email \n Phone: $phone \n Debtor: $debtor \n Debtor's Address: $debtora \n 'Client' has read Assignment and Contract Agreement: $value \n Print Name: $pname \n Title: $title \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n \n Employee ID: $employee \n IP: $ip"; $recipient = "mail@crapower.com"; $subject = "Online Authorization Form 33.3%"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>"; $ip = $_POST['visitoraddress'] ?> hello all, im wondering if it is possible to have multiple check boxes that get created based on the number of rows in a table (one representing each row) Code: [Select] <input type='checkbox' name='approve[$tid]' value='ON'> and then have a submit button at the bottom of the page that will find all of the checkboxes (it could be 1, or 100) and submit it to my form handling page. thanks I keep getting the warning "unable to send"
and yet I use everything in the for correctly.
Please help me out. I have spent hours looking for an answer.
It also posts the checkboxes I select at the bottom. I just want to be sent to the email, not necessarily echoed so I can view it.
Thanks
<?php // Functions to filter user inputs function filterName($field){ // Sanitize user name $field = filter_var(trim($field), FILTER_SANITIZE_STRING); // Validate user name if(filter_var($field, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"/^[a-zA-Z\s]+/")))){ return $field; }else{ return FALSE; } } function filterEmail($field){ // Sanitize e-mail address $field = filter_var(trim($field), FILTER_SANITIZE_EMAIL); // Validate e-mail address if(filter_var($field, FILTER_VALIDATE_EMAIL)){ return $field; }else{ return FALSE; } } function filterString($field){ // Sanitize string $field = filter_var(trim($field), FILTER_SANITIZE_STRING); if(!empty($field)){ return $field; }else{ return FALSE; } } // Define variables and initialize with empty values $nameErr = $emailErr = $messageErr = ""; $name = $email = $subject = $message = ""; // Processing form data when form is submitted if($_SERVER["REQUEST_METHOD"] == "POST"){ // Validate user name if(empty($_POST["name"])){ $nameErr = 'Please enter your name.'; }else{ $name = filterName($_POST["name"]); if($name == FALSE){ $nameErr = 'Please enter a valid name.'; } } // Validate email address if(empty($_POST["email"])){ $emailErr = 'Please enter your email address.'; }else{ $email = filterEmail($_POST["email"]); if($email == FALSE){ $emailErr = 'Please enter a valid email address.'; } } // Validate message subject if(empty($_POST["subject"])){ $subject = ""; }else{ $subject = filterString($_POST["subject"]); } // Validate user comment if(empty($_POST["message"])){ $messageErr = 'Please enter your comment.'; }else{ $message = filterString($_POST["message"]); if($message == FALSE){ $messageErr = 'Please enter a valid comment.'; } } // Check input errors before sending email if(empty($nameErr) && empty($emailErr) && empty($messageErr)){ // Recipient email address $to = 'youremail@example.com'; // Create email headers $headers = 'From: '. $email . "\r\n" . 'Reply-To: '. $email . "\r\n" . 'X-Mailer: PHP/' . phpversion(); // Sending email if(mail($to, $subject, $message, $Activity, $headers)){ echo '<p class="success">Your message has been sent successfully!</p>'; }else{ echo '<p class="error">Unable to send email. Please try again!</p>'; } } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Contact Form</title> <style type="text/css"> .error{ color: red; } .success{ color: green; } </style> </head> <body> <h2>Contact Us</h2> <p>Please fill in this form and send us.</p> <form action="" method="post"> <p> <label for="inputName">Name:<sup>*</sup></label> <input type="text" name="name" id="inputName" value="<?php echo $name; ?>"> <span class="error"><?php echo $nameErr; ?></span> </p> <p> <label for="inputEmail">Email:<sup>*</sup></label> <input type="text" name="email" id="inputEmail" value="<?php echo $email; ?>"> <span class="error"><?php echo $emailErr; ?></span> </p> <p> <label for="inputSubject">Subject:</label> <input type="text" name="subject" id="inputSubject" value="<?php echo $subject; ?>"> </p> <p> <label for="inputComment">Message:<sup>*</sup></label> <textarea name="message" id="inputComment" rows="5" cols="30"><?php echo $message; ?></textarea> <span class="error"><?php echo $messageErr; ?></span> </p> <p> <input type="checkbox" name="Activity[Sit]" value="Sit" /> value1 <br> <input type="checkbox" name="Activity[sloth]" value="Sloth" /> value2<br> <input type="checkbox" name="Activity[Run]" value="Run" /> value3 <br> </p> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form> <?php if(!empty($_POST['Activity'])) { foreach($_POST['Activity'] as $check) { echo $check; //echoes the value set in the HTML form for each checked checkbox. //so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5. //in your case, it would echo whatever $row['Report ID'] is equivalent to. } } ?> Edited by roguewonder, 14 August 2014 - 09:56 PM. Hey guys, So basically I created a page where people fill out some information such as their name, e-mail, phonenumer etc. This works perfectly by now. I also would like them to be able to check 6 checkboxes as optional fields something like: "I like to eat : (checkbox 1 ) cookies - (checkbox 2 ) chocolate .. etc" So when I give each html checkbox a name and id such as "cookies" how do I process this information in my php formscript? would it look like this? <?php session_start(); if(isset($_POST['Submit'])) { $youremail = 'myemail@gmail.com'; $fromsubject = 'subject email'; $chocolate = $_POST['chocolate']; $cookies = $_POST['cookies']; $to = $youremail; $mailsubject = ''.$fromsubject.' actionpage'; $body = $fromsubject.' Cookies: '.$cookies.' ?> The idea is that I will receive an e-mail that will tell me whether a box was checked or not and I am not sure how to make it work exactly. any help would be really awesome! William I built a series of insertion forms to put entries into a mysql database. Everything is working fine, except that I just now realized my checkboxes don't put any entry in. It's just leaving it's respective smallint field as a default "0". Being new, I've must've overlooked how to handle these. The form's checkboxes have a bit of code in the value that remembers what users chose in case they have to backtrack and redo their form. How would I solve the problem and keep this code? Here's what all the checkboxes are written like: Code: [Select] <input type="checkbox" name="green_leaf" value="<?php if(isset($_POST['1'])) echo $_POST['1']; ?>" > green So I've been scanning forms with checkboxes the same way for years and I can't help but think there's a better way. Sometimes when testing, it get caught in infinite loops the way I do it because basically I'll have it like so: formpage.php Code: [Select] <form action=processform.php> a1 <input type=hidden name=id value='1'> <input type=checkbox name=a1> <br> a2 <input type=hidden name=id value='2'> <input type=checkbox name=a2> // etc etc for all checkboxes and then, <input type=hidden name=tracker value='-1000'> <input type=submit value='Submit'> </form> processform.php Code: [Select] while(current($_POST) != '-1000') { // do stuff with current($_POST) to check the id and the value of the $_POST after it and then call next($_POST) to go to the next line } The reason I do this is because if a user clicks the a1 box, there is a value in the $_POST['a1'], but all boxes that are not checked do not pass through a variable. There must be a better way to do this Hi
I'm totally green when it comes to php, but am learning it the hard way. Any help is appreciated.
I have a form the currenty uses a custom taxonomy but it has a text field, and I want it to call and list the taxonomy items with checkboxes so instead of entering words the visitor can just multiple check off the taxonomies that relate to them.
It's a job board, this is the job skill part that relates to their expertise.
There is a job category in the form, and I tried to use the syntax to get the taxonomy and implode it but
I really don't know what I'm doing.
See the "skills" item? I want to make that a bunch of checkboxes to allow selection the the pre defined resume_skills taxonomy.
http://outsourcing.j...it-resume-free/
Any help would be great, and I'm not sure what code I need to put in here.
Mark
Hello all,
I am completely sideways right now trying to get this to work. Basically I am attempting to make a form that fetches results based on a drop down and then populates a text box that the user can then edit. I have several issues, first of all, I would have to use check boxes for if a user has a certain file on record. Which would be editable, however, I have had issues displaying tinyint values of -1 as true and 0 as false.
Secondly, writing the data back to the table after clicking a submit button, I have still issues with checkboxes here and am thoroughly confused to if I need to use an array or what here.
Thirdly, should I be using PDO or mysql for this? We have an older NAS device that I will be running this on and the firmware is older.
All the info is stored in the same table, and would be selecting a single record at a time for a user to edit. I was thinking I would just write back ALL values to the table when submit is clicked? Is that a bad idea?
As you can tell I just need someone to kick my butt in the right direction, I feel like I have read all the different ways to skin a cat but confused myself in the process.
Thanks
Can someone please help? I am simply trying to email process a form with checkboxes and then redirect to a thank you page. It works fine as long as at least one checkbox is checked. It breaks if no checkboxes are checked using the implode function to list the "interests". I'm getting this error (and no redirect to my thank you page): Warning: implode() [function.implode]: Invalid arguments passed... <?php if (isset($_REQUEST['submit'])) { $email = $_REQUEST['email']; $firstName = $_REQUEST['firstName']; $lastName = $_REQUEST['lastName']; $address = $_REQUEST['address']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zipcode = $_REQUEST['zipcode']; $homePhone = $_REQUEST['homePhone']; $cellPhone = $_REQUEST['cellPhone']; $interest = $_REQUEST['interest']; $imploded_interest = implode(',',$interest); $comments = $_REQUEST['comments']; $to = 'myemailhere@yahoo.com'; $subject = 'Volunteer Signup'; $message = " <html> <head> <title>Volunteer Signup</title> </head> <body> <p>Hello,<br/>A visitor has submitted the following information from the volunteer page:</p> <p><b>$firstName $lastName</b><br/> $address<br/> $city, $state $zipcode<br/><br/> Home Phone: $homePhone<br/> Cell Phone: $cellPhone<br/> Email: <strong>$email</strong><br/><br/> I would like to help in the following ways:<br/> $imploded_interest </p><br/> <p>$firstName would also like share the following comments:<br/> <q><i>$comments</i></q> </p> </body> </html> "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Volunteer Signup <myemailhere@yahoo.com>' . "\r\n"; mail($to, $subject, $message, $headers); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Volunteer</title> </head> <body> <form id="VolunteerForm" method="post" action="thankyou.php"> <table> <tr> <td style="width:150px;">Email Address:</td> <td><input name="email" type="text" id="email" /></td> <td style="width:320px;" class="padtr"><strong>Ways I can help:</strong></td> </tr> <tr> <td>First Name:</td> <td><input name="firstName" type="text" id="firstName" /></td> <td class="padtr"><input name="interest[]" value="yard-sign" type="checkbox"/> Put a yard sign in my yard</td> </tr> <tr> <td>Last Name:</td> <td><input name="lastName" type="text" id="lastName" /></td> <td class="padtr"><input name="interest[]" value="fundraiser-at-home" type="checkbox" /> Host a fundraiser at my home</td> </tr> <tr> <td>Address:</td> <td><input name="address" type="text" id="address" /></td> <td class="padtr"><input name="interest[]" value="phone-calls" type="checkbox" /> Make phone calls to friends and family</td> </tr> <tr> <td>City:</td> <td><input name="city" type="text" id="city" /></td> <td class="padtr"><input name="interest[]" value="mailings" type="checkbox" /> Help with mailings</td> </tr> <tr> <td>State:</td> <td><input name="state" type="text" id="state" /></td> <td class="padtr"><input name="interest[]" value="doors-literature" type="checkbox" /> Help knock on doors and distribute literature</td> </tr> <tr> <td>Zip Code:</td> <td><input name="zipcode" type="text" id="zipcode" /></td> <td class="padtr"><input name="interest[]" value="donate" type="checkbox" /> Make a donation</td> </tr> <tr> <td>Home Phone:</td> <td><input name="homePhone" type="text" id="homephone" /></td> <td class="padtr"><input name="interest[]" value="endorsement" type="checkbox" /> Use my name as an endorsement</td> </tr> <tr> <td>Cell Phone:</td> <td><input name="cellPhone" type="text" id="cellphone" /></td> <td class="padtr"><input name="interest[]" value="newsletter" type="checkbox" /> Sign up for our newsletter</td> </tr> <tr> <td>Comments:</td> <td><textarea name="comments" id="comments" rows="5" cols="17"></textarea></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> <input type="submit" name="submit" id="submit" value="Submit Now" /> <input type="reset" name="reset" id="reset" value="Clear Form" /></td> </tr> </table> </form> </body> </html> Hello,
I need a contact form with fields:
Name:
Email:
Phone:
Message:
I have html contact form but when a visitor clicks on submit button then a pop up says thnq for contacting us and he need to be on the same page. the details has to get in mail to me.
HELLO EVERYONE I HAVE A HTML FORM ON A HTML PAGE FOR USE AS A FEEDBACK FORM. I WANT TO WRITE THE USER-ENTERED DETAILS INTO A MYSQL DATABASE I AM USING A WEB HOSING SERVICE WHO HAVE TOLD ME THAT TO CONNECT TO THE DATABASE I NEED TO USE PDO (PHP DATABASE OBJECT). HERE IS MY PRESENT PHP CODING TO DO THIS TASK AS OF DATE: <?php if(isset($_POST['email'])) { function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['firstname']) || !isset($_POST['lastname']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['bustype']) || !isset($_POST['description'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $firstname = $_POST['firstname']; // required $lastname = $_POST['lastname']; // required $email = $_POST['email']; // required $telephone = $_POST['telephone']; // not required $bustype = $_POST['bustype']; // required $description = $_POST['description']; // required $con = new PDO("mysql:host=mysql.hostinger.in;dbname=databasename",'username', 'password'); $query = "INSERT INTO `databasename` (`id`, `firstname`, `lastname`, `bustype`, `email`, `telephone`, `description`, `timestamp`,) VALUES (NULL, '$firstname', '$lastname', '$bustype', '$email', '$telephone', '$description', CURRENT_TIMESTAMP,)"; $q = $con->prepare($query); $q->execute(array(':$firstname' => $_POST['firstname'], ':$lastname' => $_POST['lastname'], ':$bustype' => $_POST['bustype'], ':$email' => $_POST['email'],':$telephone' => $_POST['telephone'], ':$description' => $_POST['description'], )); echo "<h2>Thank you for filling in our contact. We shall get back to you as soon as possible.</h2>"; $con = null; ?> Hey, I have my contact form in my website working fine I'm just asking a simple question because I don't know so much about php and php syntax I have my html file calling this code below when i'm clicking on the submit button Just take a look at the last line when there is the 'echo' script I want it to go to this link, and instead it's just writing the link what is the right command/code that should i use? <? $subject="from ".$_GET['fName']; $headers= "From: ".$_GET['fEmail']."\n"; $headers.='Content-type: text/html; charset=UTF-8' . "\r\n"; mail("mymail@example.com", $subject, " <html> <head> <title> My Title </title> </head> <body> <br> ".$_GET['fName']. " <br> ".$_GET['fPhone']." <br> ".$_GET['fEmail']." <br><br> ".$_GET['pBody']." </body> </html>" , $headers); echo "http://avrikim123.co.cc/sent.html"; ?> Hey everyone, I have a really simple php contact form that I managed to mess up and can't for the life of me figure out what the problem is. It accepts the responses and will continue to the "success" page like it's supposed to, but it doesn't mail the data from the form fields when it does. I was hoping you'd be able to take a look and maybe find the error(s)... I know it's probably something really simple and stupid but I can't figure it out. Thanks in advance!! Code: [Select] <?php //----------------------------------------------------- //----------------------------------------------------- $address= "jm.horvatin@gmail.com"; //----------------------------------------------------- //----------------------------------------------------- $firstname = $_REQUEST["First Name: "]; $lastname = $_REQUEST["Last Name: "]; $phone = $_REQUEST["Phone Number: "]; $referred = $_REQUEST["I was referred by: "]; $address = $_REQUEST["Address: "]; $city = $_REQUEST["City: "]; $province = $_REQUEST["Province: "]; $postal = $_REQUEST["Postal Code: "]; $email = $_REQUEST["Email Address: "]; $mime_boundary = md5(time()); $headers = "From: $name <$email>\n"; $headers .= "Reply-To: $subject <$email>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n"; $message = "--$mime_boundary\n\n"; $message .= "New Web Registration: \n\n\n"; $message .= "First Name: $firstname \n\n"; $message .= "Last Name: $lastname \n\n"; $message .= "Phone Number: $phone \n\n"; $message .= "I was referred by: $referred \n\n"; $message .= "Address: $address \n\n"; $message .= "City: $city \n\n"; $message .= "Province: $province \n\n"; $message .= "Postal Code: $postal \n\n"; $message .= "Email Address: $email \n\n"; $message .= "--$mime_boundary--\n\n"; $mail_sent = mail($address, $subject, $message, $headers); header("location:paypal.html"); ?> ?> Code: [Select] <form action="get_mail.php" method="POST" class="contactform"> <p>First Name <input name="firstname" type="text" / class="box" value="" size="35"> Last Name <input name="lastname" type="text" class="box" value="" size="40"/> <br> Phone <input name="phonenumber" type="text" value="" class="box"> I was referred by <input name="referred" type="text" class="box" value="" size="45"> <br> Address <input name="address" type="text" class="box" value="" size="35"> City <input name="city" type="text" class="box" value="" size="20"> Province <input name="province" type="text" class="box" value="" size="7"> Postal Code <input name="postal" type="text" class="box" value="" size="6"> Email Address <input name="email" type="text" class="box" value="" size="40"> <br> <br> Automatic month-to-month: This is a month-to-month program and is considered active and ongoing until cancelled as described in the Cancellation policy. CANCELLATION POLICY: ShapeIt! member must give notice of cancellation by Email to totalfitnessbc@gmail.com at least 5 business days from the above stated debit date. Even if you notify your instructor, you still are required to send and email to <a href="mailto:totalfitnessbc@gmail.com">totalfitnessbc@gmail.com</a> Save a record of this email to serve as your cancellation receipt. 30-day money back guarantee is contingent upon receiving an email of cancelation to totalfitnessbc@gmail.com within the first 30 days of signing this agreement.</p> <p><br> I certify that I have fully read and understand the terms of this Agreement and will comply with the contents herein. Prepay memberships are non-refundable after the 30 day money back guarantee period expires. <br> <br> <input type="submit" class="contactform" value="Proceed to Payment" target="_blank"> <br class="clear" /> </p> </form> Hello All, I need some VERY DETAILED direction from anyone who can tell me how to complete this task. I set up my database "riptide" in Php MyAdmin for the following data to be submitted by user. Also a " form.php " form with the following fields. Salutation: Mr. Mrs. Ms. Miss. Dr. Prof. (radio buttons) input name="salutation" type="radio" value="Mr." checked First Name: (text input field) input name="first_Name" Last Name: (text input field) input name="last_Name" E-mail: (text input field) input name="email" Zip Code: (text input field) input name="zip_code" Would you like to receive our email newsletter? Yes No (radio buttons) input type="radio" name="newsletter" value="yes" id="newsletter_0" checked Okay here is my dilemma... I need to make web form that will do the following: (1) Connects to my database (2) INSERTS the form data filled out from my user into my MySQL database. (3) I need an email that will be sent to both me and the user who filled out the web form (4) A Thank you page "displaying" all the details the user filled out in the web form. (5) Plus all fields are required and need " validation " especially the e-mail address. I made a page called "process_form. php" that will handle all of this once the submit button is clicked. How do I make this happen? Thanks in advance James Hello Guys ! I have an error in my contact.php. When I fill all the content and submit appears: "E-mail sent successfully". but when i check my e-mail there's nothing there... I'd like to know what is happening here's the code: Code: [Select] <?php session_start(); if(!$_POST) exit; /////////////////////////////////////////////////////////////////////////// // Simple Configuration Options // Enter the email address that you want to emails to be sent to. // Example $address = "joe.doe@yourdomain.com"; $address = "myemailhere@mail.com"; // Twitter Direct Message notification control. // Set $twitter_active to 0 to disable Twitter Notification $twitter_active = 0; $twitter_user = ""; $twitter_pass = ""; // END OF Simple Configuration Options /////////////////////////////////////////////////////////////////////////// // Only edit below this line if either instructed to do so by the author or have extensive PHP knowledge. // Please Note, we cannot support this file package if modifications have been made below this line. $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $comments = $_POST['comments']; // Important Variables $error = ''; if(trim($name) == '') { $error .= '<li>Your name is required.</li>'; } if(trim($email) == '') { $error .= '<li>Your e-mail address is required.</li>'; } elseif(!isEmail($email)) { $error .= '<li>You have entered an invalid e-mail address.</li>'; } if(trim($subject) == '') { $error .= '<li>Please enter a subject.</li>'; } if(trim($comments) == '') { $error .= '<li>You must enter a message to send.</li>'; } if($error != '') { echo '<div class="error_message">Attention! Please correct the errors below and try again.'; echo '<ul class="error_messages">' . $error . '</ul>'; echo '</div>'; } else { if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Advanced Configuration Option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." $e_subject = 'You\'ve been contacted by ' . $name . '.'; // Advanced Configuration Option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $msg = "You have been contacted by $name with regards to $subject.\r\n\n"; $msg .= "$comments\r\n\n"; $msg .= "You can contact $name via email, $email.\r\n\n"; $msg .= "-------------------------------------------------------------------------------------------\r\n"; if($twitter_active == 1) { $twitter_msg = $name . " - " . $comments . ". You can contact " . $name . " via email, " . $email ." or via phone " . $phone . "."; twittermessage($twitter_user,$twitter_pass,$twitter_msg); } if(mail($address, $e_subject, $msg, "From: $email\r\nReturn-Path: $email\r\n")) { echo "<fieldset>"; echo "<div id='success_page'>"; echo "<h1>Email Sent Successfully.</h1>"; echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; echo "</div>"; echo "</fieldset>"; } else { echo 'ERROR!'; // Dont Edit. } } function twittermessage($user,$pass,$comments) { // Twitter Direct Message CURL function, do not edit. $url = "http://twitter.com/direct_messages/new.xml"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_USERPWD, "$user:$pass"); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,"user=$user&text=$comments"); $results = curl_exec ($ch); curl_close ($ch); } function isEmail($email) { // Email address verification, do not edit. return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } ?> Im having a problem with my form mail on my websites. Now the problem I have only happens with sites that I upload to my hosting accounts with Host gator. The mail will only deliver to the domain email address it wont deliver to gmail or yahoo or any other email address. I tested the script on an old domain with an Irish hosting account and it works perfectly it delivers to gmail and yahoo and my domain email account. Ive been pulling my hair out talking to Hostgator staff all weekend they keep blaming gmail and yahoo and insist the problem is not on there end. Anyway I was wondering is there anything I can add to my PHP script to make sure it delivers to gmail and yahoo or is there anything wrong with my script as hostgator are saying. Maybe there is a security issue or something Im very new to php so i could be missing something simple.
Thanks for the Help
<?php /* Set e-mail recipient */ $myemail = "info@shaneswebdesign.com"; /* Check all form inputs using check_input function */ $yourname = check_input($_POST['yourname'], "Enter your name"); $subject = check_input($_POST['subject'], "Write a subject"); $email = check_input($_POST['email']); $website = check_input($_POST['website']); $likeit = check_input($_POST['likeit']); $how_find = check_input($_POST['how']); $comments = check_input($_POST['comments'], "Write your comments"); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* If URL is not valid set $website to empty */ if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website)) { $website = ''; } /* Let's prepare the message for the e-mail */ $message = "Hello! Your contact form has been submitted by: Name: $yourname E-mail: $email URL: $website Area of Interest? $how_find Comments: $comments End of message "; /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor to the thank you page */ header('Location: http://www.shanesweb...m/thanks.php'); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <b>Please correct the following error:</b><br /> <?php echo $myError; ?> </body> </html> <?php exit(); } ?> I was able to edit this code from my word press theme.. I wanted to add a social club ID to as a text field, i was able to add the text field but i cannot seem to get the information from that field sent with the email I edited this contact form file on my word press to try and include a Social ID field, i was able to add the content to the form but i'm unable to get the information sent in the email, keeps giving me awkward results. help plz. <?php session_start(); /** * Template Name: Contact Form */ global $theme; get_header(); ?> <div id="main"> <?php $theme->hook('main_before'); ?> <div id="content"> <?php $theme->hook('content_before'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); /** * Find the post formatting for the pages in the post-page.php file */ get_template_part('post', 'page'); endwhile; else : get_template_part('post', 'noresults'); endif; ?> <div class="contact-form"> <?php if ($_POST['contact_form_submit'] ) { if(!$_POST['contact_form_name'] || !$_POST['contact_form_email'] || !$_POST['contact_form_subject'] || !$_POST['contact_form_socialid'] || !$_POST['contact_form_question'] || !$_POST['contact_form_message']) { ?><div class="error"><?php _e('Please fill in all required fields!','themater'); ?></div><?php } elseif(!is_email($_POST['contact_form_email'])) { ?><div class="error"><?php _e('Invalid email!','themater'); ?></div><?php } elseif(($_SESSION['contact_form_number_one'] + $_SESSION['contact_form_number_two']) != $_POST['contact_form_question']) { ?><div class="error"><?php _e('You entered the wrong solution..','themater'); ?></div><?php } else { wp_mail($theme->get_option('contact_form_email'), sprintf( '[%s] ' . esc_html($_POST['contact_form_subject']), get_bloginfo('name') ), esc_html($_POST['contact_form_message']),'From: "'. esc_html($_POST['contact_form_name']) .'" <' . esc_html($_POST['contact_form_email']) . '>'); unset($_POST); ?><div class="message"><?php _e('Thanks for contacting Devils First MC.','themater'); ?></div><?php } if ( isset($_SESSION['contact_form_number_one'] ) ) unset( $_SESSION['contact_form_number_one'] ); if ( isset($_SESSION['contact_form_number_two'] ) ) unset( $_SESSION['contact_form_number_two'] ); } if ( !isset($_SESSION['contact_form_number_one'] ) ) $_SESSION['contact_form_number_one'] = $contact_form_number_one = rand(1, 9); else $contact_form_number_one = $_SESSION['contact_form_number_one']; if ( !isset($_SESSION['contact_form_number_two'] ) ) $_SESSION['contact_form_number_two'] = $contact_form_number_two = rand(1, 9); else $contact_form_number_two = $_SESSION['contact_form_number_two']; ?> <form method="post" action=""> <input type="hidden" name="contact_form_submit" value="true" /> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_name']) { echo 'contact-form-required'; } ?>"><?php _e('Name','themater'); ?>:</div> <div class="contact-form-input"><input type="text" name="contact_form_name" value="<?php if ( isset($_POST['contact_form_name']) ) { echo esc_attr($_POST['contact_form_name']); } ?>" /></div> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_socialid']) { echo 'contact-form-required'; } ?>"><?php _e('Social Club ID','themater'); ?>:</div> <div class="contact-form-input"><input type="text" name="contact_form_socialid" value="<?php if ( isset($_POST['contact_form_socialid']) ) { echo esc_attr($_POST['contact_form_socialid']); } ?>" /></div> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_email']) { echo 'contact-form-required'; } ?>"><?php _e('Email','themater'); ?>:</div> <div class="contact-form-input"><input type="text" name="contact_form_email" value="<?php if ( isset($_POST['contact_form_email']) ) { echo esc_attr($_POST['contact_form_email']); } ?>" /></div> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_question']) { echo 'contact-form-required'; } ?>"><?php echo $contact_form_number_one; ?> + <?php echo $contact_form_number_two; ?> = ?</div> <div class="contact-form-input"><input type="text" name="contact_form_question" value="" /></div> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_subject']) { echo 'contact-form-required'; } ?>"><?php _e('Subject','themater'); ?>:</div> <div class="contact-form-input"><input type="text" name="contact_form_subject" value="<?php if ( isset($_POST['contact_form_subject']) ) { echo esc_attr($_POST['contact_form_subject']); } ?>" /></div> <div class="contact-form-label alignleft <?php if($_POST && !$_POST['contact_form_message']) { echo 'contact-form-required'; } ?>"><?php _e('Message','themater'); ?>:</div> <div class="contact-form-input"><textarea name="contact_form_message" ><?php if ( isset($_POST['contact_form_message']) ) { echo esc_textarea($_POST['contact_form_message']); } ?></textarea></div> <div class="contact-form-label alignleft"> </div> <div class="contact-form-input" style="text-align: center;"><input type="submit" value="<?php _e('Submit','themater'); ?>" /></div> </form> </div> <?php $theme->hook('content_after'); ?> </div><!-- #content --> <?php get_sidebars(); ?> <?php $theme->hook('main_after'); ?> </div><!-- #main --> <?php get_footer(); ?> |