PHP - Contact Us Form With Required Fields
Hi I am learning PHP and working on a Contact Us page with a required fields. For some reason it works great for the name and email, but always says please enter your phone number. If you guys have a better way of doing this please let me know. Also if the email is sent successfully I want it to goto the page "success.html" this part works good though just need some help please
Here is the form: Code: [Select] <form action="contact.php" method="post" id="contactform"> <ol> <li> <label for="name">Full Name <span class="red">*</span></label> <input id="name" name="name" class="text" /> </li> <li> <label for="email">Your email <span class="red">*</span></label> <input id="email" name="email" class="text" /> </li> <li> <label for="phone">Phone Number <span class="red">*</span></label> <input id="phone" name="phone" class="text" /> </li> <li> <label for="company">Company</label> <input id="company" name="company" class="text" /> </li> <li> <label for="topic">Subject<span class="red">*</span></label> <input id="topic" name="topic" class="text" /> </li> <li> <label for="comments">Message <span class="red">*</span></label> <textarea id="comments" name="comments" rows="6" cols="50"></textarea> </li> <li class="buttons"> <input type="image" name="imageField" id="imageField" src="images/send.gif" /> </li> </ol> </form> The PHP code I tried: Code: [Select] <?php // Pick up the form data and assign it to variables $name = check_input ($_POST['name'], "Please enter your name"); $email = check_input ($_POST['email'],"Please enter your email"); $phone = check_input ($_POST['phone'], "Please enter your phone number"); $company = $_POST['company']; $topic = check_input ($_POST['topic'], "Please enter your subject"); $comments = check_input ($_POST['comments'], "Please enter your message"); function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if (strlen($data) == 0) { die($problem); } else { return $data; } } // Build the email (replace the address in the $to section with your own) $to = 'email@email.com"'; $subject = "New message: $topic"; $message = "Email: $email \n Phone: $phone \n Company: $company \n $name said: $comments"; $headers = "From: $email"; // Send the mail using PHPs mail() function mail($to, $subject, $message, $headers); // Redirect header("Location: success.html"); ?> Similar TutorialsIf I wanted to make multiple fields required before letting a User move past the field is this the proper way to do it? Code: [Select] if(isSet($_POST['playerFirst']['playerLast']['feet']['inches']['year']['status'])) { ## Something } else { ## Something else } I was able to make my fields required and the user gets a message and has to go back and enter all of the required fields before they see a successful submission, but I still get an email every time they get the error message. Below is the code, thanks so much for your help. (fyi, i got all of the code from the web and changed to fit my needs, so I'm not entirely sure what it all does, if i had to guess, i would think the problem is in "$sent = mail($to, $subject, $body, $headers);", but that's just a guess) Code: [Select] <?php $to = "email@mydomain.com"; $email = $_REQUEST['email'] ; $fname = $_REQUEST['fname'] ; $lname = $_REQUEST['lname'] ; $phone = $_REQUEST['phone'] ; $type = $_REQUEST['type'] ; $details = $_REQUEST['details'] ; $subject = "Message from: $fname $lname"; $headers = "noreply@mydomain.com"; $body = "FirstName: $fname \n\n Lastname: $lname \n\n PhoneNumber: $phone \n\n Email: $email \n\n Type: $type \n\n Details: $details \n\n"; $sent = mail($to, $subject, $body, $headers) ; if ($_POST['fname']=="") { Print("Ooops, please use your back button and provide your first name!<br>"); } elseif ($_POST['lname']=="") { Print("Ooops, please use your back button and provide your last name!<br>"); } elseif ($_POST['phone']=="") { Print("Ooops, please use your back button and provide your phone number!<br>"); } elseif ($_POST['email']=="") { Print("Ooops, please use your back button and provide your email!<br>"); } elseif($sent) {echo "<script language=javascript>window.location = 'thanks.php';</script>";} else {echo "<script language=javascript>window.location = 'error.php';</script>";} ?> I'm making a contact form using PHP, I've got the look of the form done and I'm very happy with the look - but the actual email bit is a bit challenging. I'm using the code from a contact form on css-tricks.com, and the script does send emails... and I receive them but the emails are completely blank apart from the 'name: email: message:' stuff and the subject. What am I doing wrong? Here is the code I am using: contact.html Code: [Select] <form method="post" action="contactengine.php" id="commentForm"> <div class="form"> <p><input type="text" name="fullName" id="firstName" class="required" title="Full name" /></p> <p><input type="text" name="emailAddress" id="emailAddress" class="required" title="Email Address" /></p> <p><textarea type="text" name="message" id="message" class="required" title="Message"></textarea></p> </div> <p><input type="submit" name="submit" value="Submit" class="submit-button" title="Send" /></p> </form> contactengine.php $EmailFrom = "enquiries@aplinnovations.co.uk"; $EmailTo = "info@aplinnovations.co.uk"; $Subject = "Contact Form Submission"; $fullName = Trim(stripslashes($_POST['Name'])); $emailAddress = Trim(stripslashes($_POST['Email'])); $message = Trim(stripslashes($_POST['Message'])); $Body = ""; $Body .= "Name: "; $Body .= $fullName; $Body .= "\n"; $Body .= "Email: "; $Body .= $emailAddress; $Body .= "\n"; $Body .= "Message: "; $Body .= $message; $Body .= "\n"; $success = mail($EmailTo, $Subject, $Body, "From: $emailAddress"); I really have no idea how to code in PHP, I know I'm a newbie and I'm sure this is a really dumb question... but please help! Thanks Hi, i have a script problem as I am a graphic designer with zero php knowledge. I have a contact script that sends emails but they are blank. Meaning all text fields are not sending. If you could correct this for me thanks in advance. Here is my hacked up script that sends email with empty fields: Hello All: Trying to work with PHP on a contact form with a jQuery Validation to make certain that the visitors fill out the required information. I'll try to show everything that I have, and then the error I am getting when the visitor hits "submit." I don't know PHP all that well, and trying to learn my way through it. I used a couple of tutorials to add the features I needed and did my own styling on the live site. Here is the PHP that is currently in the header of my markup: <?php //If the form is submitted if(isset($_POST['submit'])) { //Check to make sure that the First name field is not empty if(trim($_POST['firstname']) == '') { $hasError = true; } else { $firstname = trim($_POST['firstname']); } //Check to make sure that the Last name field is not empty if(trim($_POST['lastname']) == '') { $hasError = true; } else { $lastname = trim($_POST['lastname']); } //Check to make sure that the Street Address 01 field is not empty if(trim($_POST['street01']) == '') { $hasError = true; } else { $street01 = trim($_POST['street01']); } //If Street02 is filled out, give it a value $street02 = $_POST['street02']; //Check to make sure that the City field is not empty if(trim($_POST['city']) == '') { $hasError = true; } else { $city = trim($_POST['city']); } //Check to make sure that the State field is not empty if(trim($_POST['state']) == '') { $hasError = true; } else { $state = trim($_POST['state']); } //Check to make sure that the Zip field is not empty if(trim($_POST['zip']) == '') { $hasError = true; } else { $zip = trim($_POST['zip']); } //If Email is filled out, give it a value $email = $_POST['email']; //If Telephone is filled out, give it a value $telephone = $_POST['telephone']; //Default Subject Value $subject = "VMC Inquiry"; //Check checkboxes foreach($_POST['check'] as $value) { $check_msg = "Checked: $value\n"; } //If Message is filled out, give it a value $comment = $_POST['comment']; //If there is no error, send the email if(!isset($hasError)) { $emailTo = 'xxxx.xxxx@gmail.com'; //Put your own email address here $body = "Name: $firstname $lastname \n\nStreet Address: $street01 \n\nStreet Address*: $street02 \n\nCity: $city \n\nState: $state \n\nZip: $zip \n\nEmail*: $email \n\nTelephone*: $telephone \n\nCheck Box: $check_msg \n\nMessage:\n $comment"; $headers = 'From: XXXXX <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ?> So basically I am using classes to say whether or not something is required, which ties into the jQuery validation. If it isn't required, whatever the visitor types into the box is put into something like "$telephone" which is then printed in the e-mail. The markup for the forms in the body is the following: Code: [Select] <p class="contact-text-right">For more information, or to have a list of our properties mailed to you, please fill out the form below.</p> <div id="contact-wrapper"> <?php if(isset($hasError)) { //If errors are found ?> <p class="error">Please check if you've filled all the fields with valid information. Thank you.</p> <?php } ?> <?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?> <p class="accept"><strong><?php echo $firstname;?>,Your Email Successfully Sent!</strong></p> <?php } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" id="contactform"> <div id="names"> <label for="firstname"><strong>First Name:</strong></label> <input type="text" name="firstname" id="firstname" value="" class="required" /> <label for="lastname"><strong>Last Name:</strong></label> <input type="text" name="lastname" id="lastname" value="" class="required" /> </div> <div id="address01"> <label for="street01"><strong>Street Address:</strong></label> <input type="text" name="street01" id="street01" value="" class="required" /> </div> <div id="address02"> <label for="street02"><strong>Street Address*:</strong></label> <input type="text" name="street02" id="street02" value="" /> </div> <div id="city"> <label for="city"><strong>City:</strong></label> <input type="text" name="city" id="city" value="" class="required city" /> <label for="state"><strong>State:</strong></label> <input type="text" name="state" id="state" value="" class="required state" /> <label for="zip"><strong>Zip Code:</strong></label> <input type="text" name="zip" id="zip" value="" class="required zip" /> </div> <div id="email"> <label for="email"><strong>E-mail*:</strong></label> <input type="text" name="email" id="email" value="" class="email"/> <label for="telephone"><strong>Telephone*:</strong></label> <input type="text" name="telephone" id="telephone" value="" class="telephone" /> <p class="bottom">*Optional fields.</p> </div> <div class="checkbox"> <p><input type="checkbox" name="check[]" value="properties">XXX</p> <p><input type="checkbox" name="check[]" value="contact-regarding">XXXX</p> <p class="indent">(Please list properties or ask specific questions in the space below.)</p> </div> <div id="comment"> <label for="comment"></label> <textarea name="comment" id="comment" ></textarea> </div> <div id="button"> <input type="submit" value="Send Message" name="submit" /> </div> </form> All seems well until I hit submit on the live site. I think get this error returned to me: Warning: Invalid argument supplied for foreach() in ......./html/development/contact.php on line 64 The e-mail goes through, with all the information, no problems! I just can't get this error message to go away. Line 64 of contact.php is where the checkbox coding is: //Check checkboxes foreach($_POST['check'] as $value) { $check_msg = "Checked: $value\n"; } I know I've submitted a lot of code here, and tried to narrow you down to the exact spot I think the problem is, but hopefully some of you PHP gurus can pick out the flaw in a heartbeat. I really appreciate all the help. B i need help in this form Code: [Select] <FORM action="thanx.php" method="post"> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center><FONT color=#ff0000>* </FONT>title:<BR><INPUT size=40 name=title><BR></TD> </TR> </TBODY> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center><FONT color=#ff0000>* </FONT>Url<BR><INPUT size=40 name=url value=http://><BR><TD></TR></TBODY></TABLE> </TD> </TR> <TABLE width="100%" border=0> <TBODY> <TR> <TD align=center>description<BR> <textarea cols="50" rows="4" name="description"></textarea><BR><TD></TR></TBODY></TABLE> </TD> </TBODY></TABLE> <P style="TEXT-ALIGN: center" align=center><INPUT class=submit type=submit value="add" name=send></TD> </FORM> first : i want make fields required "at lest Three letters" using php not java ... but i want the user don't leave the form if this fields empty .. and i need the user don't go the add.php if this fields empty like :: please fill the blank fields second : some time my users post in the in fields ..something like this Code: [Select] <SCRIPT type=text/javascript> <!-- //--> </SCRIPT> or something like this Code: [Select] <a href=""</a> and some time user write one letter in the field i don't accept this ..because it makes problems in the results.. so what can i do to fix this and make security for this . so can anyone help me ..please 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'] ?> Hi all, I have the below which is meant to check if the required fields in a form have been submitted, however when submit is clicked, even with no values in the boxes, the form submits as normal. <?php error_reporting(E_ALL); ini_set('display_errors', '1'); include_once ('formvalidator.php'); ?> <link href="../Styles/form_dark.css" rel="stylesheet" type="text/css" /> <?php $show_form=true; if(isset($_POST['submit'])) { $validator = new FormValidator(); $validator->addValidation("user_name","req","Please fill in Name"); $validator->addValidation("user_password","req","Please enter a password"); $validator->addValidation("user_email","email", "The input for Email should be a valid email value"); $validator->addValidation("user_email","req","Please fill in Email"); if($validator->ValidateForm()) { echo "<h2>Validation Success!</h2>"; $show_form=false; } else { echo "<B>Validation Errors:</B>"; $error_hash = $validator->GetErrors(); foreach($error_hash as $inpname => $inp_err) { echo "<p>$inpname : $inp_err</p>\n"; } } } if(true == $show_form) { ?> <form class="dark" action="regdo.php" method="post" > <ol> <li> <fieldset> <legend>User Registration</legend> <ol> <li> <label for="user_name">Username</label> <input type="text" id="user_name" name="user_name" value="" /> </li> <li> <label for="user_email">E-Mail Address</label> <input type="text" id="user_email" name="user_email" value="" /> </li> <li> <label for="user_password">Password</label> <input type="password" id="user_password" name="user_password" value="" /> </li> </ol> </fieldset> </li> </ol> <p style="text-align:right;"> <input type="reset" value="CANCEL" /> <input type="submit" value="OK" /> </p> </form> <?php }//true == $show_form ?> Can anyone explain what the problem is? Cheers Hi- the code below lets me upload a CSV file to my database if I have 1 field in my database and 1 column in my CSV. I need to add to my db "player_id" from the CVS file and "event_name" and "event_type" from the form... any ideas??? here's the code: Code: [Select] <?php $hoststring =""; $database = ""; $username = ""; $password = ""; $makeconnection = mysql_pconnect($hoststring, $username, $password); ?> <?php ob_start(); mysql_select_db($database, $makeconnection); $sql_get_players=" SELECT * FROM tabel ORDER BY player_id ASC"; // $get_players = mysql_query($sql_get_players, $makeconnection) or die(mysql_error()); $row_get_players = mysql_fetch_assoc($get_players); // $message = null; $allowed_extensions = array('csv'); $upload_path = '.'; //same directory if (!empty($_FILES['file'])) { if ($_FILES['file']['error'] == 0) { // check extension $file = explode(".", $_FILES['file']['name']); $extension = array_pop($file); if (in_array($extension, $allowed_extensions)) { if (move_uploaded_file($_FILES['file']['tmp_name'], $upload_path.'/'.$_FILES['file']['name'])) { if (($handle = fopen($upload_path.'/'.$_FILES['file']['name'], "r")) !== false) { $keys = array(); $out = array(); $insert = array(); $line = 1; while (($row = fgetcsv($handle, 0, ',', '"')) !== FALSE) { foreach($row as $key => $value) { if ($line === 1) { $keys[$key] = $value; } else { $out[$line][$key] = $value; } } $line++; } fclose($handle); if (!empty($keys) && !empty($out)) { $db = new PDO( 'mysql:host=host;dbname=db', 'user', 'pw'); $db->exec("SET CHARACTER SET utf8"); foreach($out as $key => $value) { $sql = "INSERT INTO `table` (`"; $sql .= implode("`player_id`", $keys); $sql .= "`) VALUES ("; $sql .= implode(", ", array_fill(0, count($keys), "?")); $sql .= ")"; $statement = $db->prepare($sql); $statement->execute($value); } $message = '<span>File has been uploaded successfully</span>'; } } } } else { $message = '<span>Only .csv file format is allowed</span>'; } } else { $message = '<span>There was a problem with your file</span>'; } } ob_flush();?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>CSV File Upload</title> </head> <body> <form class="form" action="" method="post" enctype="multipart/form-data"> <h3>Select Your File</h3> <p><?php echo $message; ?></p> <input type="file" name="file" id="file" size="30" /> <br/> <label>Event Name:</label><input name="event_name" type="text" value="" /> <br/> <label>Event Type:</label><input name="event_type" type="text" value="" /> <br/> <input type="submit" id="btn" class="button" value="Submit" /> </form> <br/> <h3>Results:</h3> <?php do { ?> <p><?php echo $row_get_players['player_id'];?></p> <?php } while ($row_get_players = mysql_fetch_assoc($get_players)); ?> </body> </html> A while ago I purchased a website template which included a contact form, and a PHP script to process the form. I cannot find the contact form so I'm trying to figure out how to code it on my own, or find a similar one to put in it's place. The PHP file is located he http://warp.nazwa.pl/dc/innovation/php/contact/sendMessage.php The form itself is on this page: http://warp.nazwa.pl/dc/innovation/contact.html Here is the code from the JScript file. Code: [Select] // alias to jQuery library, function noConflict release control of the $ variable // to whichever library first implemented it var $j = jQuery.noConflict(); // if true the send button is blocked var g_blockSendButton = false; /*************************************** SETUP CONTACT FORM ****************************************/ function setupInputControls() { // change border color wehen controls take focus $j(".commonInput, .commonTextarea, .contactInputHuman").focus( function() { $j(this).css("border", "1px solid #3399cc"); } ); // restore border color wehen controls lost focus $j(".commonInput, .commonTextarea, .contactInputHuman").blur( function() { $j(this).css("border", "1px solid #ccc"); $j(this).css("border-right", "1px solid #eee"); $j(this).css("border-bottom", "1px solid #eee"); } ); // when input name lost focus, validate the value $j("#inputName").blur( function() { if($j(this).val() != "") { $j("#contactNameErrorMsg").css("visibility", "hidden"); } else { $j(this).css("border", "1px solid #FF0000"); $j("#contactNameErrorMsg").html(" Please enter your name").css("visibility", "visible"); } } ); // when input email lost focus validate the value $j("#inputEmail").blur( function() { if($j(this).val() != "") { // create regular expression object var regExp = new RegExp(/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9]([-a-z0-9_]?[a-z0-9])*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{2})|([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){3})(:[0-9]{1,5})?$/i); // check email address, if result is null the email string dont match to pattern var resultExp = regExp.exec($j(this).val()); if(resultExp == null) { $j(this).css("border", "1px solid #FF0000"); $j("#contactEmailErrorMsg").html(" Sorry, but this email address is incorrect").css("visibility", "visible"); } else { $j("#contactEmailErrorMsg").css("visibility", "hidden"); } } else { $j(this).css("border", "1px solid #FF0000"); $j("#contactEmailErrorMsg").html(" Please enter your email address").css("visibility", "visible"); } } ); // when input subject lost focus validate the value $j("#inputSubject").blur( function() { if($j(this).val() != "") { $j("#contactSubjectErrorMsg").css("visibility", "hidden"); } else { $j(this).css("border", "1px solid #FF0000"); $j("#contactSubjectErrorMsg").html(" You forgot to specify a subject").css("visibility", "visible"); } } ); // when input message lost focus validate the value $j("#inputMessage").blur( function() { if($j(this).val() != "") { $j("#contactMessageErrorMsg").css("visibility", "hidden"); } else { $j(this).css("border", "1px solid #FF0000"); $j("#contactMessageErrorMsg").html(" Please enter your message").css("visibility", "visible"); } } ); // when input human lost focus validate the value $j("#inputHuman").blur( function() { if(parseInt($j(this).val(), 10) == 4) { $j("#contactHumanErrorMsg").css("visibility", "hidden"); } else { $j(this).css("border", "1px solid #FF0000"); $j("#contactHumanErrorMsg").html(" You really don't know?").css("visibility", "visible"); } } ); } // end of function setupInputControl function setupSendButton() { $j("#contactSendButton").click( function() { // prevent multiple send call by user if(true == g_blockSendButton) { return; } g_blockSendButton = true; // get all data from contact form and save it in local variables var inputName = $j("#inputName").val(); var inputEmail = $j("#inputEmail").val(); var inputSubject = $j("#inputSubject").val(); var inputMessage = $j("#inputMessage").val(); var inputHuman = $j("#inputHuman").val(); // create regular expression object var regExp = new RegExp(/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9]([-a-z0-9_]?[a-z0-9])*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{2})|([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){3})(:[0-9]{1,5})?$/i); // check email address, if result is null the email string dont match to pattern var resultExp = regExp.exec(inputEmail); // check user answer, resultHuman = true if ok, false if answer is bad var resultHuman = parseInt(inputHuman, 10) == 4; // check the error by logical sum var error = (resultHuman != true) || (resultExp == null) || (inputName == "") || (inputEmail == "") || (inputSubject == "") || (inputMessage == ""); // if there was an error we must display some informotion and mark // input cotrol with wrong data if(error) { $j("#contactNameErrorMsg").css("visibility", "hidden"); $j("#contactEmailErrorMsg").css("visibility", "hidden"); $j("#contactSubjectErrorMsg").css("visibility", "hidden"); $j("#contactMessageErrorMsg").css("visibility", "hidden"); $j("#contactHumanErrorMsg").css("visibility", "hidden"); $j("#contactErrorPanel").slideUp(300); // errors processing if(inputName == "") { $j("#inputName").css("border", "1px solid #FF0000"); $j("#contactNameErrorMsg").html(" Please enter your name").css("visibility", "visible"); } if(inputEmail == "") { $j("#inputEmail").css("border", "1px solid #FF0000"); $j("#contactEmailErrorMsg").html(" Please enter your email adress").css("visibility", "visible"); } else if(resultExp == null) { $j("#inputEmail").css("border", "1px solid #FF0000"); $j("#contactEmailErrorMsg").html(" Sorry, but this email address is incorrect").css("visibility", "visible"); } if(inputSubject == "") { $j("#inputSubject").css("border", "1px solid #FF0000"); $j("#contactSubjectErrorMsg").html(" You forgot to specify a subject").css("visibility", "visible"); } if(inputMessage == "") { $j("#inputMessage").css("border", "1px solid #FF0000"); $j("#contactMessageErrorMsg").html(" Please enter your message").css("visibility", "visible"); } if(resultHuman != true) { $j("#inputHuman").css("border", "1px solid #FF0000"); $j("#contactHumanErrorMsg").html(" You really don't know?").css("visibility", "visible"); } // unblock send button g_blockSendButton = false; } else // if no error, if all data is set correctly { // let's define function called after ajax successfull call function phpCallback(data) { // if success if(data == "ok") { $j("#contactErrorPanel").text(""); $j("#contactErrorPanel").css("background-color", "#ccFFcc"); $j("#contactErrorPanel").append("Your email was sent."); $j("#contactErrorPanel").css("border", "1px solid #339933"); $j("#contactErrorPanel").slideDown(300, function(){ g_blockSendButton = false;}); $j("#inputName").val(""); $j("#inputEmail").val(""); $j("#inputSubject").val(""); $j("#inputMessage").val(""); $j("#inputHuman").val(""); } else // if error/problem during email sending in php script { $j("#contactErrorPanel").text(""); $j("#contactErrorPanel").css("background-color", "#FFcccc"); $j("#contactErrorPanel").css("border", "1px solid #993333"); $j("#contactErrorPanel").append("There was an error sending your email."); $j("#contactErrorPanel").slideDown(300, function(){ g_blockSendButton = false;}); } } // end of function phpCallback // all data is correct so we can hide error/success panel $j("#contactErrorPanel").slideUp(300); // build data string for post call var data = "inputName="+inputName; data += "&"+"inputEmail="+inputEmail; data += "&"+"inputSubject="+inputSubject; data += "&"+"inputMessage="+inputMessage; // try to send email via php script executed by server $j.post("php/contact/sendMessage.php", data, phpCallback, "text"); // unblock send button } // end else all dara } ); } // end of function setupSendButton /*************************************** MAIN CODE - CALL THEN PAGE LOADED ****************************************/ // binding action to event onload page $j(document).ready( function() { // common.js setupGlobal(); setupCommunityButtons(); setupToolTipText(); setupSearchBox(); setupCufonFontReplacement(); setupSideBarMiniSlider(); setupMultiImageLightBox(); setupSidebarTabsPanel(); setupLoadingAsynchronousImages(); setupToolTipImagePreview(); setupTextLabelImagePreview(); // this file setupInputControls(); setupSendButton(); } ); Can anyone help me figure out how to do this by any chance? Hi all, firstly thank you in advance to anyone who replies to this thread. I'll be honest I'm a newbie when I comes to PHP and really am a long way to mastering it. If someone could have a look at my code and tell me where I'm going wrong here then it would be a great help.
The problem here is, when I click on the submit button it sends me to the PHP script page and doesn't actually send a email to the address.
Please Help and again, thank you in advance.
Below is the HTML,
<section> 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)); } ?> hello All, Thank you EVERYONE for all of your help... it was much appreciated. I have created a form that does the following: (1) Connects to the database that created. (2) Inserts the users data into the database (3) Displays a thank you you page after a successful form submission (4) Send an e-mail to me with all the users details I NOW need to be able to send a Custom html page to the end users e-mail with all their data... a Confirmation e-mail for their reference. Is there some special PHP Code that can HANDLE such a task? If so please tell me how might be able to integrate this in my existing code. thanks mrjap1 sir i need this contact form php code to make it work,
i make thi deign for my website but dont know what have to put in send.php
here i the code
<h4>Send a Message</h4> <div class="contact-form" method="post" action="send.php"> <form role="form"> <div class="form-group"> <label for="name">Name</label> <input type="text" name="name" placeholder="" id="name" class="form-control"> </div> <div class="form-group"> <label for="email">Email</label> <input type="text" name="email" placeholder="" id="email" class="form-control"> </div> <div class="form-group"> <label for="phone">Skype</label> <input type="text"name="subject" id="phone" class="form-control"> </div> <div class="form-group"> <label for="phone">Message</label> <textarea placeholder="" name="message" rows="5" class="form-control"></textarea> </div> <button class="btn btn-danger" type="submit">Submit</button> </form> Edited by soumikr, 22 December 2014 - 11:35 AM. Hello All, I made an external "Thank you.html" page that I want to show immediately after the " Send Your Info" button on my "request_more_info.php " form is clicked. This MUST stay external always. I want this to be called in somehow by php. So is there some php code I can use to accomplish this? Also is there some php code I can use to validate my entire form and ESPECIALLY the e-mail address portion on my form? If so could you tell me who do i apply it to my "request_more_info.php " Salutation: (radio buttons) First Name: (input field) Last Name: (input field) Address: (input field) City: (input field) State: (select option) Zip: (input field) Country: (select option) Email: (input field) Our Newsletter: (radio buttons) thanks MrJAP1 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(); } ?> 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> 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(); ?> Hi everyone, i was trying to create a little script for my blog but cant do that. What i want is this model with dropdown options: http://www.pasidedans.ro/inscrie-te-acum I want to replace my entire cod so i dont want to modify him.. Can you help me to create a contact form like this ? thanks ! |