Jump to content

Search the Community

Showing results for tags 'contact'.

  • 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 (PhpStorm, VS Code, 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 14 results

  1. Hello im new to PHP and i have problems getting PHP working for my websites contac form Here the HTML form code <form action="" method="post"> <div class="form_settings"> <p><span>Name</span><input class="contact" type="text" name="your_name" value="" /></p> <p><span>Email Address</span><input class="contact" type="text" name="your_email" value="" /></p> <p><span>Message</span><textarea class="contact textarea" rows="8" cols="50" name="your_enquiry"></textarea></p> <p style="padding-top: 15px"><span> </span><input class="submit" type="submit" name="contact_submitted" value="submit" /></p> </div> </form> Heres the PHP code <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'example@gmail.com'; $subject = 'Message from '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Sent'); window.location = 'kontakt.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Error'); window.location = 'kontakt.html'; </script> <?php } ?> I would be really thankful if someone could fix the PHP code for me and make it work with the html above.
  2. 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>
  3. Hey guys! I'm trying to add an upload feature to my contact form. I had one before that simply added the image under the text in the email not as an actual attachment and it was pretty easy but I lost the code and can’t seem to find it again. But I seem to be having a problem finding a form that can help me add this. As of now the code in HTML has the upload but the PHP doesn’t at all. If anyone could help me add the rest of the PHP code I'd really appreciate it! HTML: <form name="htmlform" method="post" action="oc.php"><label for="fname"><p>Full Name:</p></label> <input type="text" name="fname" maxlength="50" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td valign="top"> <label for="phone"> <p>Phone Number: </p></label> <input type="text" name="phone" maxlength="50" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td valign="top"> <label for="email"> <p> Email Address: </p></label> <input type="text" name="email" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> </tr> <tr> <td> <h4>DELIVERY INFORMATION:</h4> <label for="address"> <p>Address: </p></label> <input type="text" name="address" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="city"> <p>City: </p></label> <input type="text" name="city" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="state"> <p>State: </p></label> <input type="text" name="state" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="zip"> <p>Zip Code: </p></label> <input type="text" name="zip" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <h4>INFORMATION:</h4> <label for="first"> <p>First Name: </p></label> <input type="text" name="first" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="last"> <p>Last Name: </p></label> <input type="text" name="last" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="rec"> <p>Recommendation ID Number: </p></label> <input type="text" name="rec" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="exp"> <p>Recommendation Experation Date: </p></label> <input type="text" name="exp" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="doc"> <p>Doctors Name: </p></label> <input type="text" name="doc" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="docphone"> <p>Doctors Phone Number: </p></label> <input type="text" name="docphone" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> <label for="ver"> <p>Verification Website: </p></label> <input type="text" name="ver" maxlength="80" size="60" style="color:#000;" required="required"> </td> </tr> <tr> <td> </td> </tr> <tr> <td valign="top"><label for="message"><p>How did you hear about us?</p></label><textarea name="message" id="message" style="background-color:#fff; color:#000;" cols="45"/></textarea></td> </tr> <tr> <td colspan="2" style="text-align:left"> <p> Upload Recommendation:</p> <input type="file" name="pic" id="pic"> <br /> <p> Upload California State ID:</p> <input type="file" name="id" id="id"> <br /> <br /> <input type="image" value="submit"img src="img/sub.png" onmouseover="this.src='img/sub1.png'" onmouseout="this.src='img/sub.png'" /> </form> PHP: <?php // first clean up the input values foreach($_POST as $key => $value) { if(ini_get('magic_quotes_gpc')) $_POST[$key] = stripslashes($_POST[$key]); $_POST[$key] = htmlspecialchars(strip_tags($_POST[$key])); } $ip=$_SERVER['REMOTE_ADDR']; $email_to = "info@example.com"; $email_subject = "Register"; $email_message .= "Full Name: ".$_POST["fname"]."\n"; $email_message .= "Phone Number: ".$_POST["phone"]."\n"; $email_message .= "Email Address: ".$_POST["email"]."\n"; $email_message .= "Address: ".$_POST["address"]."\n"; $email_message .= "City: ".$_POST["city"]."\n"; $email_message .= "State: ".$_POST["state"]."\n"; $email_message .= "Zip Code: ".$_POST["zip"]."\n"; $email_message .= "First Name: ".$_POST["first"]."\n"; $email_message .= "Last Name: ".$_POST["last"]."\n"; $email_message .= "Recommendation ID Number: ".$_POST["rec"]."\n"; $email_message .= "Recommendation Exp Date: ".$_POST["exp"]."\n"; $email_message .= "Doctors Name: ".$_POST["doc"]."\n"; $email_message .= "Doctors Phone Number: ".$_POST["docphone"]."\n"; $email_message .= "Verification Website: ".$_POST["ver"]."\n"; $email_message .= "Message: ".$_POST["message"]."\n"; $userEmail = filter_var( $_POST['email'],FILTER_VALIDATE_EMAIL ); if( ! $userEmail ){ exit; } //email headers $headers = 'From: '.$_POST["email"]."\r\n". 'Reply-To: '.$_POST["email"]."\r\n" . 'X-Mailer: PHP/' . phpversion(); echo (mail($email_to, $email_subject, $email_message, $headers) ? "<html><head><meta http-equiv='Refresh' content='0; url=http://www..com/thankyou.html'><body bgcolor='#fff'> ":"<html><body bgcolor='#fff'><center><font color='white'><h2>We're sorry, something went wrong.</h2></font><p><font color='white'>Please return to <a href='http://www..com'></a>.</font></p></center></body></html>"); $ip=$_SERVER['REMOTE_ADDR']; $email_to = $_POST["email"]; $email_subject = "420 In Action"; $email_message1 = "Welcome! Sincerely, "; //email headers $headers = 'From: '.$_POST["email"]."\r\n". 'Reply-To: '.$_POST["email"]."\r\n" . 'X-Mailer: PHP/' . phpversion(); echo (mail($email_to, $email_subject, $email_message1, $headers) ? "":""); exit(); // test input values for errors $errors = array(); if(strlen($fname) < 2) { if(!$fname) { $errors[] = "You must enter a name."; } else { $errors[] = "Name must be at least 2 characters."; } } if(!$email) { $errors[] = "You must enter an email."; } else if (!validEmail($email)) { $errors[] = "You must enter a valid email."; } if($errors) { // output errors to browser and die with a failure message $errortext = ""; foreach($errors as $error) { $errortext .= "<li>".$error."</li>"; } die("<span class='failure'>The following errors occured:<ul>". $errortext ."</ul></span>"); } // check to see if email is valid function validEmail($email) { $isValid = true; $atIndex = strrpos($email, "@"); if (is_bool($atIndex) && !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen < 1 || $localLen > 64) { $isValid = false; } // local part length exceeded else if ($domainLen < 1 || $domainLen > 255) { $isValid = false; } // domain part length exceeded else if ($local[0] == '.' || $local[$localLen-1] == '.') { $isValid = false; } // local part starts or ends with '.' else if (preg_match('/\\.\\./', $local)) { $isValid = false; } // local part has two consecutive dots else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { $isValid = false; } // character not valid in domain part else if (preg_match('/\\.\\./', $domain)) { $isValid = false; } // domain part has two consecutive dots else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) { // character not valid in local part unless local part is quoted if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) { $isValid = false; } } if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) { $isValid = false; } // domain not found in DNS } return $isValid; } ?>
  4. Hi everyone. Pretty desperate, first time that I'm working with php. Learning this language, makes sense, however I can't figure out why my code is not working. Emails are not coming in at all. Additional required info (phone number, first name, last name) should be included in the message. Please help. Thank you everyone. <?php $to = "abcd@abcd.com"; $subject = "From Website Contact Form"; $first = $_REQUEST['first']; $last = $_REQUEST['last']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; $MESSAGE_BODY = "Name: " . $_POST["first"] . "\n"; $MESSAGE_BODY = "Name: " . $_POST["last"] . "\n"; $MESSAGE_BODY = "Contact No: " . $_POST["phone"] . "\n"; $MESSAGE_BODY = "Email: " . $_POST["email"] . "\n"; $MESSAGE_BODY = "Requirement: " . nl2br($_POST["message"]) . "\n"; $message = $_REQUEST['message' + 'email' + 'first' + 'last']; $from = $_REQUEST['email']; $headers = "From:" . $from; mail($to, $subject, $MESSAGE_BODY, $headers); echo "Your message has been sent"; ?>
  5. Hi, I am trying to get my contact form from page into header. I have been at his for days now, I can get the contact form into the header with this <?php echo do_shortcode( '[contact-form 1 "Contact form 1"]' ); ?> but can not get it to sit centrally and in front of image. This is my site, http://www.cloudchasing.co.uk/ The site style that I am trying to emulate is this one http://www.premierwindscreens.co.uk/ Pleeeease help a newcomer
  6. I've built my website off of a template and have everything working except for the contact form. When I test the form and fill it out, it sends the email through to me except the content doesn't all send. I receive messages that say... Email = name@email.com Name = First Last Phone = 123-456-7890 Message = Email = name@email.com Name = First Last Phone = 123-456-7890 To sum it up, instead of a subject line only an email address is shown and more importantly the message section only displays an email. Below is all of the code I have associated with the form, I was looking for somewhere where message=email but failed to find it. Any help is greatly appreciated. PHP <?php $send_email_to = "name@email.com"; function send_email($name,$email,$phone,$subject,$message) { global $send_email_to; if($message=='message')$message=''; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: ".$email. "\r\n"; $message = "<strong>Email = </strong>".$email."<br>"; $message .= "<strong>Name = </strong>".$name."<br>"; $message .= "<strong>Phone = </strong>".$phone."<br>"; $message .= "<strong>Message = </strong>".$message."<br>"; @mail($send_email_to, $subject, $message,$headers); return true; } function validate($name,$email,$phone,$message,$subject) { $return_array = array(); $return_array['success'] = '1'; $return_array['name_msg'] = ''; $return_array['email_msg'] = ''; $return_array['phone_msg'] = ''; $return_array['message_msg'] = ''; $return_array['subject_msg'] = ''; if($email == '') { $return_array['success'] = '0'; $return_array['email_msg'] = 'email is required'; } else { $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email)) { $return_array['success'] = '0'; $return_array['email_msg'] = 'Enter valid email.'; } } if($name == '') { $return_array['success'] = '0'; $return_array['name_msg'] = 'Name is required'; } else { $string_exp = "/^[A-Za-z .'-]+$/"; if (!preg_match($string_exp, $name)) { $return_array['success'] = '0'; $return_array['name_msg'] = 'Enter valid Name.'; } } if($subject == '') { $return_array['success'] = '0'; $return_array['subject_msg'] = 'Subject is required'; } if($message == '') { $return_array['success'] = '0'; $return_array['message_msg'] = 'Message is required'; } else { if (strlen($message) < 2) { $return_array['success'] = '0'; $return_array['message_msg'] = 'Enter valid Message.'; } } return $return_array; } $name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $message = $_POST['message']; $subject = $_POST['subject']; $return_array = validate($name,$email,$phone,$message,$subject); if($return_array['success'] == '1') { send_email($name,$email,$phone,$subject,$message); } header('Content-type: text/json'); echo json_encode($return_array); die(); ?> HTML <article class="grid_12"> <h2>Contact Me</h2> <p>Use the form to send me an email and I should get back to you within 24 hours. <br> Or if you <i>really</i> need to talk to me give me a call, I'd love to hear from you. My number's listed below.<br><br></p> <form action="#" method="post" id="cform" name="cform"> <ul id="homehireus" class="hireform contactform"> <li> <label>Name:<span class="required">*</span></label> <input name="name" id="name" type="text" value="" tabindex="1"> </li> <li> <label>Email:<span class="required">*</span></label> <input name="email" id="email" type="text" value="" tabindex="2"> </li> <li> <label>Subject:<span class="required">*</span></label> <input name="subject" id="subject" type="text" value="" tabindex="4"> </li> <li> <label>Phone:<span class="required">*</span></label> <input name="phone" id="phone" type="text" value="" tabindex="3" placeholder="867-5309" > </li> <li> <label>Message:<span class="required">*</span></label> <textarea name="message" id="message" value="" tabindex="5"></textarea> </li> <li> <input type="button" id="send-message" value="Tell Me What You're Thinking" tabindex="6"> <div id="output" class="contactpage-msg"></div> </li> </ul> </form> </article> Java $(document).ready(function () { $('div#output').hide(); //bind send message here $('#send-message').click(sendMessage); $('button.close').live('click', function () { $(this).parent().find('p').html(''); $(this).parent().hide(); }); }); /* Contact Form */ function checkEmail(email) { var check = /^[\w\.\+-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,6}$/; if (!check.test(email)) { return false; } return true; } function sendMessage() { // receive the provided data var name = $("input#name").val(); var email = $("input#email").val(); var subject = $("input#subject").val(); var phone = $("input#phone").val(); var message = $("textarea#message").val(); message = 'message'; // check if all the fields are filled if (name == '' || phone == '' || email == '' || subject == '' || message == '') { $("div#output").show().html('<button type="button" class="close" data-dismiss="alert-close">x</button><p class="alert-close">You must enter all the fields!</p>'); return false; } // verify the email address if (!checkEmail(email)) { $("div#output").show().html('<button type="button" class="close" data-dismiss="alert">x</button><p>Please enter a valid Email Address</p>'); return false; } // make the AJAX request var dataString = $('#cform').serialize(); $.ajax({ type: "POST", url: 'contact.php', data: dataString, dataType: 'json', success: function (data) { if (data.success == 0) { var errors = '<ul><li>'; if (data.name_msg != '') errors += data.name_msg + '</li>'; if (data.email_msg != '') errors += '<li>' + data.email_msg + '</li>'; if (data.phone_msg != '') errors += '<li>' + data.phone_msg + '</li>'; if (data.message_msg != '') errors += '<li>' + data.message_msg + '</li>'; if (data.subject_msg != '') errors += '<li>' + data.subject_msg + '</li>'; $("div#output").removeClass('alert-success').addClass('alert-error').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p> Could not complete your request. See the errors below!</p>' + errors); } else if (data.success == 1) { $("div#output").removeClass('alert-error').addClass('alert-success').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p>You message has been sent successfully!</p>'); } }, error: function (error) { $("div#output").removeClass('alert-success').addClass('alert-error').show().html('<button type="button" class="close" data-dismiss="alert">x</button><p> Could not complete your request. See the error below!</p>' + error.statusText); } }); return false; }
  7. I've been combing forums for 2 weeks now trying to find a way to have a working contact form on my portfolio site. I couldn't have fathomed how difficult this task is turning out to be. I'm a competent HTML and CSS developer. PHP, however, is new to me. I've been studying up on it at treehouse and understand the basic $_POST, echo, and !isset commands. My site is live at http://kovcreation.com/ I'm not married to the contact form that's on there but i understand it entirely. I'm just so frustrated after trying many different solutions I just want it to work !!! Any help is greatly appreciated Form HTML <div class="contact_form"> <div class="touch"> </div> <form id="contact_me_form" method="post" action="email.php"> <div class="error_contact" id="name_error">Name is Required</div> <input type="text" placeholder="Your Name (required)" id="name" class="textbox" /> <input type="text" name="email" id="email" placeholder="Your Email (required)" class="textbox email"> <div class="error_contact" id="comment_error">Message is Required</div> <textarea cols="25" rows="5" name="message" id="comment" class="textbox message" placeholder="Your Message ( Inquiry? , Freelance Work? , or Just to Say Hi...)"></textarea> <input type="image" src="img/send.png" alt="Send Message" name="submit" class="button submit_btn"> </form> </div> email php <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "michael@kovcreation.com"; $email_subject = "Contact from portfolio site"; 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['message'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $first_name = $_POST['name']; // required $email_from = $_POST['email']; // 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 .= "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); ?> <p>Thank you for contacting us. We will be in touch with you very soon.</p> <?php } ?> Thanks for reading email.php index.html style.css
  8. Hi, not sure if ive posted this in the right section, but im making a website thats mainly html but ive thrown some PHP for the contact us page, i have used a form that requires the user to send a message to an email, ive tested it and i get the message that ive set to show that its sucessfully sent, but when i check my email to see if it has sent well... it hasn't, im new to PHP but do i have to have the site online in order for the message to send?
  9. Hi, I have use the below link to make a contact form; http://www.websitecodetutorials.com/cod ... dation.php When I submit the form I get an error '22527'. Cant work out what it is and having searched I can't make sense of other answers mainly because I am only just starting out in PHP. The Form <form method="post" action="bookingform1.php"> <ul> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="First Name" name="firstname" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Last Name" name="lastname" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Nationality" name="nationality" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Date Of Birth" name="dob" maxlength="25"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Gender" name="gender" maxlength="15"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Occupation" name="occupation" maxlength="40"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Home Address" name="address" maxlength="80"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="E-mail Address" name="email" maxlength="80"></input></li> <li class='field'><input class="xwide text input" id='iyc-form-width' type="text" placeholder="Telephone Number" name="telephone" maxlength="25"></input></li> <p id='iyc-bold'>Your preferred choice of programme date</p> <li class="field" id='text_align_left'> <div class="picker" id='iyc-picker-width'> <select name="first"> <option>October 12-19th 2013</option> <option>November 16-23rd 2013</option> <option>January 18-25th 2014</option> <option>February 15-22nd 2014</option> <option>March 15-22nd 2014</option> </select> </div> </li> <p id='iyc-bold'>Your second choice, (should your preferred date be unavailable)</p> <li class="field" id='text_align_left'> <div class="picker" id='iyc-picker-width'> <select name="second"> <option>October 12-19th 2013</option> <option>November 16-23rd 2013</option> <option>January 18-25th 2014</option> <option>February 15-22nd 2014</option> <option>March 15-22nd 2014</option> </select> </div> </li> <p id='iyc-bold'>What experience do you have of the english language (self-taught/lessons/on-line programmes/immersion programmes)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="Background & experience" name="experience" maxlength="600"></textarea></li> <p id='iyc-bold'>Why do you want to attend the programme? (practice the language/to get a job/promotion/expand career opportunities/social)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="What do you want to get out?" name="why" maxlength="600"></textarea></li> <p id='iyc-bold'>How did you hear about the A.B.C. Experience Programme?</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="How did you find us?" name="how" maxlength="600"></textarea></li> <p id='iyc-bold'>Additional information (include any dietary or other special needs you may require.)</p> <li class='field'><textarea class="input textarea" rows="6" placeholder="Additional information" name="info" maxlength="600"></textarea></li> <li class="field"><label class="checkbox" for="checkbox1" id='text_align_left'><input name="checkbox1" type="checkbox" id="checkbox1" name="terms" value="0"><span></span> *By ticking this box you accept our terms and conditions as per the below</label></li> <div class="pretty warning danger btn icon-left info-circled" id='iyc-btn'><a href="termsandconditions.pdf" target="_blank">Terms & Conditions</a></div> </ul> <div align="center"> <!-- <h4>For e-mail security purposes please enter in the words above and then click submit below.</h4> --> </div> <div class="pretty medium default btn" style='margin-top:20px;'><input type="submit" value="Submit"></input></div> </form> <?php // Input Your Personal Information Here $mailto = 'oliver@edwardsltd.co.uk' ; $from = "ABC Experience England Website - Participants" ; $formurl = "http://www.dev.abcexperienceengland.co.uk/bookingform1.php" ; $errorurl = "http://www.dev.abcexperienceengland.co.uk/formmailerror.php" ; $thankyouurl = "http://www.dev.abcexperienceengland.co.uk/thankyou.php" ; // End Edit // prevent browser cache header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); function remove_headers($string) { $headers = array( "/to\:/i", "/from\:/i", "/bcc\:/i", "/cc\:/i", "/Content\-Transfer\-Encoding\:/i", "/Content\-Type\:/i", "/Mime\-Version\:/i" ); if (preg_replace($headers, '', $string) == $string) { return $string; } else { die('You think Im spammy? Spammy how? Spammy like a clown, spammy?'); } } $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; if (!isset($_POST['email'])) { header( "Location: $errorurl" ); exit ; } // Input Your Personal Information Here $firstname = remove_headers($_POST['firstname']); $lastname = remove_headers($_POST['lastname']); $nationality = remove_headers($_POST['nationality']); $dob = remove_headers($_POST['dob']); $gender = remove_headers($_POST['gender']); $occupation = remove_headers($_POST['occupation']); $homeaddress = remove_headers($_POST['homeaddress']); $email = remove_headers($_POST['email']); $telephone = remove_headers($_POST['telephone']); $first = remove_headers($_POST['first']); $second = remove_headers($_POST['second']); $experience = remove_headers($_POST['experience']); $why = remove_headers($_POST['why']); $how = remove_headers($_POST['how']); $info = remove_headers($_POST['info']); $terms = remove_headers($_POST['terms']); $http_referrer = getenv( "HTTP_REFERER" ); // End Edit if (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i",$email)) { header( "Location: $errorurl" ); exit ; } // Input Your Personal Information Here if (empty($firstname) || empty($lastname) || empty($nationality) || empty($dob) || empty($gender) || empty($occupation) || empty($homeaddress) || empty($email) || empty($telephone) || empty($first) || empty($second) || empty($experience) || empty($why) || empty($how) || empty($info) || empty($terms)) { header( "Location: $errorurl" ); exit ; } // End Edit if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } // sets max amount of characters in comments area (edit as nesesary) if (strlen($comments) > 1250) { $comments=substr($comments, 0, 1250).'...'; } // End Edit $message = "This message was sent from:\n" . "$http_referrer\n\n" . // Input Your Personal Information Here "First Name: $firstname\n\n" . "Last Name: $lastname\n\n" . "Nationality: $nationality\n\n" . "DOB: $dob\n\n" . "Gender: $gender\n\n" . "occupation: $occupation\n\n" . "homeaddress: $homeaddress\n\n" . "E-mail: $email\n\n" . "Telephone: $telephone\n\n" . "first: $first\n\n" . "second: $second\n\n" . "What experience do you have: $experience\n\n" . "Why do you want: $why\n\n" . "How did you hear about us: $how\n\n" . "Other Information: $info\n\n" . "Agree to the terms: $terms\n\n" . "\n\n------------------------------------------------------------\n" ; // End Edit mail($mailto, $from, $message, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep ); header( "Location: $thankyouurl" ); exit ; ?> http://www.dev.abcexperienceengland.co.uk/ I am using GUMBY as the CSS framework. As mentioned I am a newbie to PHP so apologise in advance for any stupid mistakes. Any help to get this working would be much appreciated. Thanks in advance Olly Edwards
  10. Hi everyone, this is my first time using php. i have made a basic contact form and hosted it, (http://www.prowinduk.com/contact/index.html) how do i make it so after the form has been sent, it resets the form and shows a message saying "message sent" please can some one help, i am using dreamweaver cs5. sorry if this has been mentioned in the past as i searched all over but could not find a answer. any help/advise would be usehull, thanks below is the text code stuff: <?php $EmailFrom = "online@prowinduk.com"; $EmailTo = "turbine@prowinduk.com"; $Subject = "online form"; $Name = Trim(stripslashes($_POST['name'])); $Email = Trim(stripslashes($_POST['email'])); $Tel = Trim(stripslashes($_POST['tel'])); $Message = Trim(stripslashes($_POST['message'])); $Pcode = Trim(stripslashes($_POST['pcode'])); // validation $validationOK=true; if (!$validationOK) { echo "please check your details"; header("Location: http://prowinduk.com/contact/send_email.php"); exit; } // prepare email body text $Body = ""; $Body .= "Full Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Telephone #: "; $Body .= $Tel; $Body .= "\n"; $Body .= "E-mail: "; $Body .= $Email; $Body .= "\n"; $Body .= "Address: "; $Body .= $Message; $Body .= "\n"; $Body .= "Postcode: "; $Body .= $Pcode; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"1;URL=index.php\">"; } ?>
  11. Right so i'm trying to make a subscribe page at the moment for my website. I've got a section that's listed be the first one to see it here...from there i wanted to make a text box for the user to type their email address and then a button to submit and send me an email of the users email address. Also, I wanted to make the submit button my own graphic and not just a button? The HTML code is: <form class="email" action="mailer.php" method="post"> <input name="email" type="text" size="70" /> <input class="send" type="submit" value="Send"> </form> and the PHP: <?php /* Set e-mail recipient */ $myemail = "cweyer@hotmail.co.uk"; /* Check all form inputs using check_input function */ $email = check_input($_POST['email']); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* Send the message using mail() function */ mail($myemail); /* Redirect visitor to the thank you page */ header('Location: thanks.html'); 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> <p>Please correct the following error:</p> <strong><?php echo $myError; ?></strong> <p>Hit the back button and try again</p> </body> </html> <?php exit(); } ?> If anyone could help it would be so appreciated! To get more of an idea on my problem, visit www.itscharlottesweb.co.uk
  12. contact form weird I could receive the email but my php has some problem which makes the receving email looks strange, and can't use reply function on outlook. anyone could help me improve it. thank you. this contact.php <body> <?php $field_firstname = $_POST['firstname'];" ".$_POST['lastname']; $field_emailaddress= $_POST['emailaddress']; $field_telepohone = $_POST['telephone']; $field_country = $_POST['country']; $field_business = $_POST['business']; $field_comments = $_POST['comments']; $mail_to = 'info@ABC.com'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$_POST['emailaddress']."\n"; $body_message .= 'Message: \n'.$_POST['emailaddress']."\n"; $body_message .= $_POST['telephone']."\n"; $body_message .= $_POST['country']."\n"; $body_message .= $_POST['business']."\n"; $body_message .= $_POST['comments']; $headers = 'From: '.$_POST['emailaddress'].'\r\n'; $headers .= 'Reply-To: '.$_POST['emailaddress'].'\r\n'; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); <!-- window.location.href = "http://www.ABC.com/thankyou.html"; //--> </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please check the items required'); <!-- window.location.href = "http://www.ABC.com/contact.html"; //--> </script> <?php } ?> this is contact.html <form action="contact.php" method="post" name="form1" target="_blank" class="email" id="form1" onsubmit="MM_validateForm('firstname','','R','lastname','','R','emailaddress','','NisEmail','comments','','R');return document.MM_returnValue"> <p>If you need more information about our inspection, sourcing, auditing, and verification service, <br /> <br /> pls contact below address or just fill in the form below, our customer service will get you back <br /> <br /> as soon as possible. thank you for considering ABC!</p> <p>First Name: <label for="firstname"></label> <input type="text" name="firstname" id="firstname" /> <br /> <br /> Lsat Name: <label for="lastname"></label> <input type="text" name="lastname" id="lastname" /> <br /> <br /> Email Address: <label for="emailaddress"></label> <input type="text" name="emailaddress" id="emailaddress" /> <br /> <br /> Telephone: <label for="telephone2"></label> <input type="text" name="telephone" id="telephone" /> <label for="TEL"></label> <br /> <br /> Country: <label for="country"></label> <select name="country" id="country"> <option>Australia</option> <option>Austria</option> <option>Belgium</option> <option>Czech Republic</option> <option>Denmark</option> <option>Finland</option> <option>France</option> <option>Germany</option> <option>Greece</option> <option>Hungary</option> <option>Italy</option> <option>Netherlands</option> <option>Norway</option> <option>Poland</option> <option>Romania</option> <option>Russia</option> <option>Spain</option> <option>Sweden</option> <option>Switzerland</option> <option>United Kingdom</option> <option>Canada</option> <option>Mexico</option> <option>United States of America</option> <option>Argentina</option> <option>Brazil</option> <option>New Zealand</option> <option>Egypt</option> <option>Iran</option> <option>Israel</option> <option>Kuwait</option> <option>Saudi Arabia</option> <option>Turkey</option> <option>Japan</option> <option>South Korea</option> <option>Vietnam</option> <option>other</option> </select> <br /> <br /> Business: <label for="business"></label> <select name="business" id="business"> <option>wholesale</option> <option>retail</option> <option>industrial</option> <option>services</option> <option>distributor</option> <option>manufacturer</option> <option>importer</option> <option>other</option> </select> <label for="telephone"></label> <label for="FAX"></label> <br /> <br /> Comments:<br /> <br /> <label for="comments"></label> <textarea name="comments" id="comments" cols="45" rows="5"></textarea> <br /> <br /> <input name="submit" type="submit" id="submit" onclick="MM_validateForm('firstname','','R','lastname','','R','emailaddress','','RisEmail','telephone','','NisNum','comments','','R');return document.MM_returnValue" value="Submit" /> <br /> </p> </form> another problem is that the verification function doesn't work, people could send me blank email, but when I try myself, it works. thank you for you help.
  13. Hey guys. I've been having some frustrating issues with my php + contact form recently. I'm quite the noob when it comes to php in general and have only really worked with contact stuff in the past. I have my contact form calling a php send mail file in a php folder on my server. No idea why, but im not even getting validation. I click send, to no avail. I have attached the code for your perusal. I appreciate any help in advance!! Thank you. Form: <form id="contact-form" class="fixed" action="javascript:void(0);"> <fieldset> <p id="formstatus"></p> <p> <label for="name">Your name: <span class="required">*</span></label><br /> <input class="text" type="text" id="name" name="name" value="" /> </p> <p> <label for="email">Your Email Address: <span class="required">*</span></label><br /> <input class="text" type="text" id="email" name="email" value="" /> </p> <p> <label for="subject">Subject: <span class="required">*</span></label><br /> <input class="text" type="text" id="subject" name="subject" value="" /> </p> <p> <label for="message">Message: </label><br /> <textarea id="message" name="message" rows="3" cols="25"></textarea> </p> <p> <input type="submit" name="submit" value="Send!" /> </p> </fieldset> </form> PHP file (send.php): I've hidden the send to email address for obvious reasons. <?php /////////// Add your own email below //////////////// define("WEBMASTER_EMAIL", 'blah@blah.com'); error_reporting (E_ALL ^ E_NOTICE); ////////////////////////////////////////////////////// function ValidateEmail($email) { $regex = '/([a-z0-9_.-]+)'. # name '@'. # at '([a-z0-9.-]+){2,255}'. # domain & possibly subdomains '.'. # period '([a-z]+){2,10}/i'; # domain extension if($email == '') return false; else $eregi = preg_replace($regex, '', $email); return empty($eregi) ? true : false; } ////////////////////////////////////////////////////// $post = (!empty($_POST)) ? true : false; if($post) { $name = stripslashes($_POST['name']); $email = trim($_POST['email']); $subject = trim($_POST['subject']); $message = stripslashes($_POST['message']); $error = ''; // Check name if(!$name) $error .= 'Name required! '; // Check email if(!$email) $error .= 'E-mail required! '; if($email && !ValidateEmail($email)) $error .= 'E-mail address is not valid! '; // Check message if(!$message) $error .= "Please enter your message!"; if(!$error) { $mail = mail(WEBMASTER_EMAIL, $subject, $message, "From: ".$name." <".$email.">\r\n" ."Reply-To: ".$email."\r\n" ."X-Mailer: PHP/" . phpversion()); if($mail) echo 'OK'; } else echo '<div class="errormsg">'.$error.'</div>'; } ?> and javascript: // ------------------------------------------------------------------------------------------------------- // Form Validation script - used by the Contact Form script // ------------------------------------------------------------------------------------------------------- function validateMyAjaxInputs() { $.validity.start(); // Validator methods go here: $("#name").require(); $("#email").require().match("email"); $("#subject").require(); // End the validation session: var result = $.validity.end(); return result.valid; } // ------------------------------------------------------------------------------------------------------- // ClearForm // ------------------------------------------------------------------------------------------------------- $.fn.clearForm = function() { return this.each(function() { var type = this.type, tag = this.tagName.toLowerCase(); if (tag == 'form') return $(':input',this).clearForm(); if (type == 'text' || type == 'password' || tag == 'textarea') this.value = ''; else if (type == 'checkbox' || type == 'radio') this.checked = false; else if (tag == 'select') this.selectedIndex = -1; }); }; $(document).ready(function(){ ////////////////////////////////////////////////////////////////////////////////////////////////////////////// I would appreciate any help! Thanks
  14. I bought a template online which has a pop-up quick contact form on each page.Please help me construct a php form to make it work.I'm new to PHP Please help me!! This html form is given below. 1) Could someone please help me remove the "website" fieldset and add "Tel" for telephone number(optional) in that field instead?? 2).Please help me contruct a php form to make the HTML contact form below work. <form> <fieldset><input name="Name" type="text" value="Name:" onfocus="if(this.value=='Name:')this.value='';" onblur= "if(this.value=='')this.value='Name:';"/></fieldset> <fieldset><input name="Mail" type="text" value="E-Mail:" onfocus="if(this.value=='E-Mail:')this.value='';" onblur= "if(this.value=='')this.value='E-Mail:';"/></fieldset> <fieldset><input name="Web" type="text" value="Web:" onfocus="if(this.value=='Web:')this.value='';" onblur= "if(this.value=='')this.value='Web:';"/></fieldset> <fieldset><textarea name="Message" onfocus="if(this.value=='Message:')this.value='';" onblur= "if(this.value=='')this.value='Message:';">Message:</textarea></fieldset> <fieldset><input type="submit" value="Send" /></fieldset> </form>
×
×
  • 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.