Jump to content

Search the Community

Showing results for tags 'contact form'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 10 results

  1. Hi, Just wondered if anyone can help? A contact form which has previously worked has stopped working, I presume because the PHP has been upgraded to version 5.6. If anyone is able to advise on how I need to tweak it, it would be massively appreciated! Code below: Thanks, Sarah <? // edit these lines $your_name="Company Name"; $your_email="sarah@companyname.co.uk"; $your_web_site_name="companyname.co.uk"; ?> <?php //If the form is submitted if(isset($_POST['name'])) { //Check to make sure that the name field is not empty if(trim($_POST['name']) === '') { $nameError = 'Please enter your name.'; $hasError = true; } else { $name = trim($_POST['name']); } //Check to make sure sure that a valid email address is submitted if(trim($_POST['email']) === '') { $emailError = 'Please enter your email address.'; $hasError = true; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) { $emailError = 'You entered an invalid email address.'; $hasError = true; } else { $email = trim($_POST['email']); } //Check to make sure comments were entered if(trim($_POST['message']) === '') { $commentError = 'Please enter your message.'; $hasError = true; } else { if(function_exists('stripslashes')) { $comments = stripslashes(trim($_POST['message'])); } else { $comments = trim($_POST['message']); } } //If there is no error, send the email if(!isset($hasError)) { $emailTo = $your_email; $subject = 'Contact Form Submission from '.$name; $body = "Name: $name \n\nEmail: $email \n\nPhone: ".trim($_POST['phone'])." \n\nComments: $comments"; $headers = 'From: '.$your_web_site_name.' <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); $emailSent = true; } } ?> <?php if(isset($emailSent) == true) { ?> <div class="ok"> <h1>Thanks, <?php echo $name;?></h1> <p>Your email was successfully sent. We will be in touch soon.</p> </div> <?php } ?> <?php if(isset($hasError) ) { ?> <div class="error2">There was an error submitting the form.</div> <?php } ?>
  2. Hello all, It's my first time here, I hope you will be indulgent. I am trying to create a contact form in php, using something that a former employee at my company has written for another website. Please note that I have no knowledge whatsoever of php (except what I've learned while creating it...). Here is the code I am working with. Can you go through and let me know if see anything that seems off to you? Thank you very much! <?php /* ******************************************************************************************** CONFIGURATION ******************************************************************************************** */ // destinataire est votre adresse mail. Pour envoyer à plusieurs à la fois, séparez-les par une virgule $destinataire = 'myemail'; // copie ? (envoie une copie au visiteur) $copie = 'oui'; // Action du formulaire (si votre page a des paramètres dans l'URL) // si cette page est index.php?page=contact alors mettez index.php?page=contact // sinon, laissez vide $form_action = ''; // Messages de confirmation du mail $message_envoye = "Votre message nous est bien parvenu. Merci !"; $message_non_envoye = "L'envoi du mail a échoué, veuillez réessayer SVP."; // Message d'erreur du formulaire $message_formulaire_invalide = "Vérifiez que tous les champs soient bien remplis et qu'il n'y ait pas d'erreur dans votre adresse courriel."; /* ******************************************************************************************** FIN DE LA CONFIGURATION ******************************************************************************************** */ /* * cette fonction sert à nettoyer et enregistrer un texte */ function Rec($text) { $text = htmlspecialchars(trim($text), ENT_QUOTES); if (1 === get_magic_quotes_gpc()) { $text = stripslashes($text); } $text = nl2br($text); return $text; }; /* * Cette fonction sert à vérifier la syntaxe d'un email */ function IsEmail($email) { $value = preg_match('/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(??:(?:[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!\.)){0,61}[a-zA-Z0-9_-]?\.)+[a-zA-Z0-9_](?:[a-zA-Z0-9_\-](?!$)){0,61}[a-zA-Z0-9_]?)|(?:\[(??:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email); return (($value === 0) || ($value === false)) ? false : true; } // formulaire envoyé, on récupère tous les champs. $name = (isset($_POST['name'])) ? Rec($_POST['name']) : ''; $email = (isset($_POST['email'])) ? Rec($_POST['email']) : ''; $tel = (isset($_POST['tel'])) ? Rec($_POST['tel']) : ''; $sujet = (isset($_POST['sujet'])) ? Rec($_POST['sujet']) : ''; $message = (isset($_POST['message'])) ? Rec($_POST['message']) : ''; // On va vérifier les variables et l'email ... $email = (IsEmail($email)) ? $email : ''; // soit l'email est vide si erroné, soit il vaut l'email entré $err_formulaire = false; // sert pour remplir le formulaire en cas d'erreur si besoin if (isset($_POST['envoi'])) { if (($name != '') && ($tel != '')) { // les 4 variables sont remplies, on génère puis envoie le mail //$headers = 'From:'.$name.' <'.$email.'>' . "\r\n"; //$headers .= 'Reply-To: '.$email. "\r\n" ; //$headers .= 'X-Mailer:PHP/'.phpversion(); $headers = "From: " . $name . "\r\n"; $headers .= "Reply-To: ". $email . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; // envoyer une copie au visiteur ? if ($copie == 'oui') { $cible = $destinataire.';'.$email; } else { $cible = $destinataire; }; // Remplacement de certains caractères spéciaux $message = str_replace("'","'",$message); $message = str_replace("’","'",$message); $message = str_replace(""",'"',$message); $message = str_replace('<br>','',$message); $message = str_replace('<br />','',$message); $message = str_replace("<","<",$message); $message = str_replace(">",">",$message); $message = str_replace("&","&",$message); // Envoi du mail $num_emails = 0; $tmp = explode(';', $cible); foreach($tmp as $email_destinataire) { $msg = '<html><body>'; $msg .= '<h1>Vous avez reçu une soumission</h1>'; $msg .= '</body></html>'; $msg = '<html><body>'; $msg = '<h3>Formulaire : </h3>'; $msg .= "<tr><td><strong>Prénom Nom : </strong> </td><td>" . $name . "</td></tr>"; $msg .= "<tr><td><strong>Courriel : </strong> </td><td>" . $email . "</td></tr>"; $msg .= "<tr><td><strong>Téléphone : </strong> </td><td>" . $tel . "</td></tr>"; $msg .= "<tr><td><strong>Sujet : </strong> </td><td>" . $sujet . "</td></tr>"; $msg .= "<tr><td><strong>Message :</strong> </td><td>" . $message . "</td></tr>"; } $msg .= "</table>"; $msg .= "</body></html>"; //$msg = $name.'</br>'.$email.'</br>'.$tel.'</br>'.$sujet.'</br>'.$message; if (mail($email_destinataire, $name, $msg, $headers)) $num_emails++; } } ?>
  3. 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.
  4. Hi I am a newbie with PHP. I created a contact form following a tutorial online and have uploaded the index.html and contact-form.php form to a server with php enabled. I am getting an error message Warning! Please fill all the fields. ”; } else { mail($to,$subject,$msg,”From:”.$email); echo “ I am wondering if anyone can advise me? The PHP: <?php $to="calming1@yahoo.co.uk";/*Your Email*/ $subject="Message from the website"; $date=date("l, F jS, Y"); $time=date("h:i A"); $name=$_REQUEST['name']; $email=$_REQUEST['email']; $message=$_REQUEST['message']; $msg=" Message sent from website form on date $date, hour: $time.\n Name: $name\n Email: $email\n Message: $message\n "; if($email=="") { echo "<div class='alert alert-danger'> <a class='close' data-dismiss='alert'>×</a> <strong>Warning!</strong> Please fill all the fields. </div>"; } else { mail($to,$subject,$msg,"From:".$email); echo "<div class='alert alert-success'> <a class='close' data-dismiss='alert'>×</a> <strong>Thank you for your message!</strong> </div>"; } ?> HTML <form id="contact" class="form-inline" action="contact-form.php" method="post" accept-charset="utf-8"> <div class="form-group pull-left"> <label class="sr-only" for="name">Name</label> <input type="text" class="form-control" id="name" placeholder="Name" name="name"> </div> <div class="form-group pull-right"> <label class="sr-only" for="email">Email</label> <input type="email" class="form-control" id="email" placeholder="Email" name="email"> </div> <textarea class="form-control pull-left" rows="8" placeholder="Message" name="message"></textarea> <button type="submit" class="btn pull-right">Send email</button> </form>
  5. Hello, Im designing a website and have a contact form, what is the best way of managing that and monitor it as just getting that contact form information sent to an email address they may end up having more and more people sending information will get all messy and will surely cause havoc. The only way at the moment i can think of is to store the first piece of information in a database table then store the reply's in a separate table but linked to the original first question by the id. What do you guys things?
  6. 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; ?> but I AM GETTING AN ERROR MESSAGE WHEN I TRY TEST THE HTML FORM PAGE WHICH SAYS PHP Code: Parse error: syntax error, unexpected $end in /home/u196883532/public_html/form.php on line 69 PLUS THERE IS NO DATA WRITTEN TO THE DATABASE. I NEED HELP. WHAT CAN I DO? THANKS
  7. I am using a php contact form and everything is working fine. Just one thing... After the user submits the form a "Message sent!" pops up under the form. Right now the text is quite small. How can I increase that text size? Any help for this beginner would be greatly appreciated! Here is the php code <?php if(!$_POST) exit; $email = $_POST['email']; //$error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('rollnumber','principal','name','email','phone'); $required = array('rollnumber','principal','name','email','phone' ); $your_email = "admin@edev.ie"; $email_subject = "A new message from the CAT4 Indicator Study Reply Form - ".$_POST['rollnumber']; $email_content = "A new message from the CAT4 Indicator Study Reply Form:\n"; foreach($values as $key => $value){ if(in_array($value,$required)){ if ($key != 'subject' && $key != 'company') { if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(@mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?>
  8. I have written a small contact form using .php in Dreamweaver, the message from the webpage does send... except but I cannot see (in my email client) the recipients email address to send the reply to? Moreover; the webpage has three text boxes ‘Name, Email and Message’, in my email client - I can see the person’s name (in subject line), ‘To’... shows up as my email address - i.e. info@website.com and the message is shown as it should be? The code I have written is as followed: <?php $from="reply.info@website.com"; $email="info@website.com"; $to ="info@website.com"; $subject=$_POST['Subject']; $message=$_POST[ 'Message']; mail ( $email, $subject, $message, "From:".$form); Print "Your Message has been sent"; ?>
  9. hey, ive edit a contact form i found on net, changed everything i needed, when i click the "submit" button it shows that the form was send succsesfuly but nothing comes up in the email.. what is wrong ? form code html: <form method="post" action="../booking/booking.php" id="contactform"> <div class="form"> <div class="six columns noleftmargin"> <label>* Company name:</label> <input type="text" name="companyname" class="smoothborder" placeholder="* Company name"/> </div> <div class="six columns noleftmargin"> <label>* Contact name:</label> <input type="text" name="contactname" class="smoothborder" placeholder="* Contact name"/> </div> <p> <div class="six columns noleftmargin"> <label>* Event country:</label> <input type="text" name="country" class="smoothborder" placeholder="* Event country"/> </div> <div class="six columns noleftmargin"> <label>* Event city:</label> <input type="text" name="city" class="smoothborder" placeholder="* Event city"/> </div> <p> <div class="six columns noleftmargin"> <label>* Phone number:</label> <input type="text" name="phone" class="smoothborder" placeholder="* Phone number"/> </div> <div class="six columns noleftmargin"> <label>* Email adress:</label> <input type="text" name="email" class="smoothborder" placeholder="* Email adress"/> <label for="select"></label> </div> <div class="six columns noleftmargin"> <label>* Skype:</label> <input type="text" name="skype" class="smoothborder" placeholder="* Skype"/> <label for="select"></label> </div> <div class="six columns noleftmargin"> <label>* Aritst:</label> <input type="text" name="artist" class="smoothborder" placeholder="* Artist"/> <br> <label for="select"></label> </div> <p> <input type="submit" id="submit" class="readmore" value="Submit"> </p> PHP code: <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "info@bouncerecordings.com"; $email_subject = "Booking Request"; 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['companyname']) || !isset($_POST['contactname']) || !isset($_POST['country']) || !isset($_POST['city']) || !isset($_POST['phone']) || !isset($_POST['email']) || !isset($_POST['skype']) || !isset($_POST['artist'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $companyname = $_POST['companyname']; // required $contactname = $_POST['contactname']; // required $country = $_POST['country']; // required $city = $_POST['city']; // required $phone = $_POST['phone']; // required $email = $_POST['email']; // required $skype = $_POST['skype']; // not required $artist = $_POST['artist']; // required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $error_message .= 'The Email Address you entered does not appear to be valid.<br />'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$companyname)) { $error_message .= 'The First Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$contactname)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$country)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$city)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$phone)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$skype)) { $error_message .= 'The Last Name you entered does not appear to be valid.<br />'; } if(!preg_match($string_exp,$artist)) { $error_message .= 'The Last Name you entered does 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 .= "Company Name: ".clean_string($companyname)."\n"; $email_message .= "Contact Name: ".clean_string($contactname)."\n"; $email_message .= "Country: ".clean_string($country)."\n"; $email_message .= "City: ".clean_string($city)."\n"; $email_message .= "Phone Number: ".clean_string($phone)."\n"; $email_message .= "Email: ".clean_string($email)."\n"; $email_message .= "Skype: ".clean_string($skype)."\n"; $email_message .= "Artist: ".clean_string($artist)."\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 } ?>
  10. 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> <div class="container"> <div class="row"> <div class="col-lg-2 col-lg-offset-5"> <hr class="marginbot-50"> </div> </div> <div class="row"> <div class="col-lg-8"> <div class="boxed-grey"> <form data-toggle="validator" role="form" method="post" action="email/contactus.php"> <div class="row"> <div class="col-md-6"> <div class="form-group"> <label for="name"> Name</label> <input type="text" class="form-control" name="name" id="name" placeholder="Enter name" required="required" /> </div> <div class="form-group"> <label for="email"> Email Address</label> <div class="clearfix"></div> <div class="input-group"> <span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span> </span> <input type="email" class="form-control" name="email" id="email" placeholder="Enter email" required="required" /></div> </div> <div class="form-group"> <label for="contact"> Who would you like to contact?</label> <select id="contact" name="contact" class="form-control" required="required"> <option value="" selected="">Choose One:</option> <option value="Club Chairman">Club Chairman</option> <option value="Sponsorship Secretary">Sponsorship Secretary</option> <option value="Club Captain">Club Captain</option> <option value="Club Website Administrator">Club Website Administrator</option> </select> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="name"> Message</label> <textarea name="message" id="message" class="form-control" rows="9" cols="25" required="required" placeholder="Message"></textarea> </div> </div> <div class="col-md-12"> <button type="submit" class="btn btn-skin pull-right" id="btnContactUs"> Send Your Message</button> </div> </div> </form> </div> </div> <div class="col-lg-4"> <div class="widget-contact"> <h5>Write to us</h5> <address> <strong>Abberton & District Cricket Club</strong><br> The Brow<br>Abberton Road<br>Colchester<br>Essex<br>CO5 7AW<br> <abbr title="Phone"><span class="glyphicon glyphicon-phone-alt"></span></abbr> (01206) 735244 </address> <address> <strong>Email</strong><br> <a href="mailto:#">info@abbertoncricket.co.uk</a> </address> <address> <strong>We're on social networks</strong><br> <ul class="company-social"> <li class="social-facebook"><a href="#" target="_blank"><i class="fa fa-facebook"></i></a></li> <li class="social-twitter"><a href="#" target="_blank"><i class="fa fa-twitter"></i></a></li> </ul> </address> </div> </div> </div> </div> </section> The PHP I have is: <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; $person = $_POST['contact']; $about = $_POST['about']; $query = $_POST['message']; $email_from = $name.'<'.$email.'>'; $to="info@abbertoncricket.co.uk"; $subject="Message from abbertoncricket website"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: ".$email_from."\r\n"; $message=" Hi, My name is $name. <br> I'm looking to contact the <b>$person</b> for your cricket club. <br> The subject title for my message is $about <br> My message is $query <br> If you need to contact me further about this matter then please contact me via my email address below $email <br> Thank you. $name "; if(mail($to,$subject,$message,$headers)) header("Location:../../index.html?msg=Successful Submission! Thankyou for contacting us."); else header("Location:../contact.html?msg=Error To send Email !"); } ?> Again, thankyou for your help. Sam Truss
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.