soumikr Posted December 22, 2014 Share Posted December 22, 2014 (edited) 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 December 22, 2014 by soumikr Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/ Share on other sites More sharing options...
CroNiX Posted December 22, 2014 Share Posted December 22, 2014 How are we supposed to know what you want to do with the data from the form? Put it in the database? Send an email? What are you wanting to do here? Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500390 Share on other sites More sharing options...
ginerjm Posted December 22, 2014 Share Posted December 22, 2014 Your html is a bit off kilter. The method and action attributes belong on a form tag, not a div one. Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500391 Share on other sites More sharing options...
soumikr Posted December 22, 2014 Author Share Posted December 22, 2014 How are we supposed to know what you want to do with the data from the form? Put it in the database? Send an email? What are you wanting to do here? i want to receive email, i will use it in my contact us page Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500394 Share on other sites More sharing options...
ginerjm Posted December 22, 2014 Share Posted December 22, 2014 So - besides fixing the script you already posted as I suggested, you want us to write your 'send.php' script for you? Can I ask why you have placed each of your input elements inside their own individual div tags? What's the point? Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500395 Share on other sites More sharing options...
soumikr Posted December 22, 2014 Author Share Posted December 22, 2014 (edited) So - besides fixing the script you already posted as I suggested, you want us to write your 'send.php' script for you? Can I ask why you have placed each of your input elements inside their own individual div tags? What's the point? ya sir, and i make that div for design purpose Edited December 22, 2014 by soumikr Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500397 Share on other sites More sharing options...
CroNiX Posted December 22, 2014 Share Posted December 22, 2014 The main problem, as ginerjm pointed out, is your first div. It contains the form attributes (method and action) that belong in the <form> tag. There are no such attributes in HTML for DIVs. Beyond that, the purpose of this site is to help people with THEIR problematic code, not write code from scratch for others. If this is beyond what you can do the appropriate forum would probably be the Job Offerings forum and pay someone to do it for you. Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500399 Share on other sites More sharing options...
ginerjm Posted December 22, 2014 Share Posted December 22, 2014 Yes I know that div tags are for design purposes. But when all your div tags have the same class/id on them, what's the point? Especially when you are so new to this kind of thing. Who's coaching you? Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500413 Share on other sites More sharing options...
CroNiX Posted December 22, 2014 Share Posted December 22, 2014 @ginergm, looks like he's using bootstrap, which is how they do it... http://getbootstrap.com/css/#forms Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500416 Share on other sites More sharing options...
soumikr Posted December 23, 2014 Author Share Posted December 23, 2014 (edited) k help me here i have all html and php code but it not work dont know why html code <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap-theme.css" rel="stylesheet"> <link href="css/theme.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <form class="form-horizontal" action="send_email.php" method="post" enctype="multipart/form-data" name="Contact" id="Contact"> <fieldset> <div class="form-group"> <label class="col-md-4 control-label" for="Name">Name</label> <div class="col-md-4"> <input id="Name" name="Name" placeholder="Your Name" class="form-control input-md" type="text"> </div> </div> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="Email">Email</label> <div class="col-md-4"> <input id="Email" name="Email" placeholder="Your Email Address" class="form-control input-md" required="" type="text"> </div> </div> <!-- Select Basic --> <div class="form-group"> <label class="col-md-4 control-label" for="Phone">Phone</label> <div class="col-md-4"> <input id="Phone" name="Phone" class="form-control"> </div> </div> <!-- Textarea --> <div class="form-group"> <label class="col-md-4 control-label" for="Message">Message</label> <div class="col-md-4"> <textarea class="form-control" id="message" name="message">How can we help you?</textarea> </div> </div> <!-- Button --> <div class="form-group"> <label class="col-md-4 control-label" for="Send"></label> <div class="col-md-4"> <button id="Send" name="Send" class="btn btn-info">Send</button> </div> </div> </fieldset> </form> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="js/bootstrap.min.js"></script> </body> </html> php code <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "soumikr29@gmail.com"; $email_subject = "Customer Inqkjuiry"; 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['name']) || !isset($_POST['email']) || !isset($_POST['phone']) || !isset($_POST['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $name = $_POST['name']; // required $email_from = $_POST['email']; // required $phone = $_POST['phone']; // not required $message = $_POST['message']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$name)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(strlen($message) < 2) { $error_message .= 'The message you entered do not appear to be valid.<br />'; } if(strlen($error_message) > 0) { died($error_message); } $email_message = "Form details below.\n\n"; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_message .= "Name: ".clean_string($name)."\n"; $email_message .= "Email: ".clean_string($email_from)."\n"; $email_message .= "phone: ".clean_string($phone)."\n"; $email_message .= "message: ".clean_string($message)."\n"; // create email headers $headers = 'From: '.$email_from."\r\n". 'Reply-To: '.$email_from."\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_to, $email_subject, $email_message, $headers); ?> <!-- include your own success html here --> Thank you for contacting us. We will be in touch with you very soon. <?php } ?> but email not sent sir here is the full download link of the code http://www.creativebeacon.com/bootstrap_form_10-09.zip Edited December 23, 2014 by soumikr Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500500 Share on other sites More sharing options...
jazzman1 Posted December 23, 2014 Share Posted December 23, 2014 Start from here: // html code <input id="Email" name="Email" placeholder="Your Email Address" class="form-control input-md" required="" type="text"> // php code if(isset($_POST['email'])) { } Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500501 Share on other sites More sharing options...
ginerjm Posted December 23, 2014 Share Posted December 23, 2014 What jazzman is pointing out is that PHP is very very case sensitive. I might add that I think your 'required' attribute on the input tag is incorrect. Quote Link to comment https://forums.phpfreaks.com/topic/293252-contact-form/#findComment-1500507 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.