Jump to content

Search the Community

Showing results for tags 'php form'.

  • 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 12 results

  1. Hi heres the form to take a look http://jamaicainn.com/contact.php the contact form basically is now sending all the information to the database of our external partner. I have a field "Regarding" which when selected the form information goes to the respected departments for ex., Spa goes to spa@jamaicainn.com heres the code I wrote. which doesnt seem to work <?php if ($regarding == 'Human Resources'){ // form action email(sophiaw@jamaicainn.com, $subject, $message) then redirect to } elseif ($regarding == 'Guest Relations'){ // form action email(shickling@jamaicainn.com@jamaicainn.com, $subject, $message) } elseif ($regarding == 'Spa'){ // form action email(spa@jamaicainn.com, $subject, $message) } elseif ($regarding == 'Marketing'){ // form action email(tina@jamaicainn.com, $subject, $message) }elseif ($regarding == 'Accounts'){ // form action email(debra.freak@jamaicainn.com, $subject, $message) } elseif ($regarding == 'Reservations') { // form action post(http://www.NavisTechnologies.info/Narrowcast2005/ELM/ELMContactPost.aspx) } ?> <p><form name="form1" method="post" action="http://www.NavisTechnologies.info/Narrowcast2005/ELM/ELMContactPost.aspx"> <table width="90%" border="0" cellpadding="3" cellspacing="3"> <tr> <td width="30%"> <input name="account" value="15340" type="hidden" /> <label for="FirstName">First name*</label></td> <td><input type="text" name="FirstName" id="FirstName" required></td> </tr> <tr> <td><label for="LastName">Last name*</label></td> <td><input type="text" name="LastName" id="LastName" required></td> </tr> <tr> <td><label for="EmailAddress">Email*</label></td> <td><input type="email" name="EmailAddress" id="EmailAddress" required></td> </tr> <tr> <td><label for="HomePhone">Phone</label></td> <td><input type="tel" name="HomePhone" id="HomePhone"></td> </tr> <tr> <td><label for="regarding">Regarding</label></td> <td><select name="regarding" id="regarding"> <option><p> Reservations</p></option> <option><p> Guest Relations</p></option> <option><p> Spa</p></option> <option><p> Marketing</p></option> <option><p> Human Resources</p></option> <option><p> Accounts</p></option> <option><p> Groups/Weddings</p></option> </select></td> </tr> <tr> <td><label for="CheckInDate">Check in date</label></td> <td><input name="CheckInDate" type="Date" id="CheckInDate"><a href="javascript:openCalendar('CheckInDate')"><img src="http://jamaicainn.com/calendar.gif" width="20" height="20" border="0" /></a></td> </tr> <tr> <td><label for="CheckOutDate">Check out date</label></td> <td><input name="CheckOutDate" type="Date" id="CheckOutDate"><a href="javascript:openCalendar('CheckOutDate')"><img src="http://jamaicainn.com/calendar.gif" width="20" height="20" border="0" /></a></td> </tr> <tr> <td><label for="Date">Comments</label></td> <td><textarea name="Message" id="Message" cols="30" rows="4"></textarea></td> </tr> <tr> <td> </td> <td><input name="send" type="submit" class="submit" id="send" value="SUBMIT"></td> </tr> </table> </form> <script language="javascript" type="text/javascript"> function openCalendar(FormElement){ var calendarwindow; url = "calendar.html?formname=form1&formelement=" + FormElement; calendarwindow = window.open(url,"calendar","toolbar=no,width=200,height=144,top=50,left=50,status=no,scrollbars=no,resize=no,menubar=no"); calendarwindow.focus(); } </script> Any helps appreciated Thanks
  2. Hey everyone, I purchased a template to make a website with and need a little bit of help with altering the contact form. The form works fine, when someone fills out the form online and the email comes to me, the reply to email address is the one they inputted into the form. However, when I click "reply" in the email, it changes to my email address(the $fromEmail which I was trying to override) Here is the send.php <?php $ajax = (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'); $ajax = true; //we do not allow direct script access if (!$ajax) { //redirect to contact form echo "Please enable Javascript"; exit; } require_once "config.php"; //we set up subject $mail->Subject = isset($_REQUEST['email_subject']) ? $_REQUEST['email_subject'] : "Message from site"; //let's validate and return errors if required $data = $mail->validateDynamic(array('required_error' => $requiredMessage, 'email_error' => $invalidEmail), $_REQUEST); //let's make sure we have valid data //if (!$data['errors'] && (!isset($_REQUEST['js']) || $_REQUEST['js'] != 1)) { //$data['errors']['global'] = 'Javascript is required. Please try again'; //} if ($data['errors']) { echo json_encode(array('errors' => $data['errors'])); exit; } //force to overwrite email address $mail->SetFrom($data['fields']['Email'], $data['fields']['Name'].' '.$data['fields']['Surname']); $html = '<body style="margin: 10px;"> <div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"> <h2>' . $mail->Subject . '</h2> '; foreach ($data['fields'] as $label => $val) { $html .= '<p>' . $label . ': ' . $val . '</p>'; } $html .= '</div></body>'; $mail->setup($html, $_REQUEST, array()); $result = array('success' => 1); if (!$mail->Send()) { $result['success'] = 0; } echo json_encode($result); exit; config.php <?php /** * Setup mail server config */ ini_set('display_errors', 0); //where we would like to send email $recipientEmail = 'contact@justspiffy.ca'; $recipientName = 'The Touchmark'; //Address which will be visible in "From" field $fromEmail = 'contact@justspiffy.ca'; $fromName = 'Site Admnistrator'; //Validation error messages $requiredMessage = 'Field is required'; $invalidEmail = 'Invalid email'; /** * Advanced configuration - no need to modify */ require_once(dirname(__FILE__) . '/vendor/ctPHPMailer.php'); $mail = new ctPHPMailer(); //set your email address $mail->AddAddress($recipientEmail, $recipientName); $mail->SetFrom($fromEmail, $fromName); $debug = false; //if problems occur, set to true to view debug messages I do not know much about php so I am not sure what to do to make it stay as the users email address when they click "reply" on the email. Any ideas would be great.
  3. Hi, I created a form that inserts first - last name, address, and email address into a mysql databse table. The record inserts correctly - No problems here. The problem is I only want to insert the data if the email and address doesn't exist. I set it up for just the email right now to try to get this to work but have failed. When the form is submitted and the record exists it inserts the record anyway and sends the email which it's not suppose to do. The form is suppose to after submitting - 1. validate 2. insert only if the record doesn't exist 3. send the email. Here's the code <?php $to = "email@email.com"; if(isset($_POST['submit'])) { // VALIDATION if(empty($_POST['firstName'])) { $errorfirstName .= "First Name Required"; } if(empty($_POST['lastName'])) { $errorfirstName .= "Last Name Required"; } if(empty($error)) # No error go ahead and email it. { $to = "$to"; $subject = 'the form'; $msg .="<html><head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> <title>The Form</title> </head> <body> <table> <tr> <td>Email sent for confirmation</td> </tr> </table> </body> </html>"; $mail($to, $subject, $headers, $msg); if(!$result) { $error = "<div id='errors'>There was an unknown error </div>"; } else { include('connection.php'); $firstName = mysqli_real_escape_string($con, $_POST['firstName']); $lastName = mysqli_real_escape_string($con, $_POST['lastName']); $address = mysqli_real_escape_string($con, $_POST['address']); $email = mysqli_real_escape_string($con, $_POST['email']); $email = $_POST['email']; $sql = "SELECT * FROM table WHERE `email` = '{$email}'"; $result = mysql_query($sql); if ( mysql_num_rows ( $result ) > 0 ) { $error = "Email Exists."; } else { $error = "Email does not exist. Insert it!!!"; $sql="INSERT INTO table (firstName, lastName, address, email) VALUES ('$_POST[firstName]','$_POST[lastName]','$_POST[address]', '$_POST[email]')"; } if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } mysqli_close($con) { } } } } ?> <!-- Form --> <html> <head></head> <body> <section> <form method="POST" action="theform" name="for" onsubmit="return validateForm(this)"> <?php if(!empty($error)) { echo "$error"; } ?> This where the inputs would go not going to include them because not having an issue with the form </form> </section> </body> </html>
  4. Please help me with this. I'm using this little PHP program to collect some information and get them emailed to me...everything is working but no messages in the body. The email comes to me but nothing in the body. I'm supposed to get the name, email, phone # and how soon but I receive a blank email. I have the script posted on celebritynosejobs.net if you would like to see it! <?php $action=$_REQUEST['action']; if ($action=="") /* display the contact form */ { ?> <br /><br /> <font size='1'>Fill out the form below and we'll contact you with more information as soon as possible.</font><br /><br /> <form action="" method="POST" enctype="multipart/form-data"> <input type="hidden" name="action" value="submit"> <b>Your full name:</b><br> <input name="name" type="text" value="" size="30"/><br> <b>Your email address:</b><br> <input name="email" type="text" value="" size="30"/><br> <b>Your Phone #:</b><br> <input name="phone" type="text" value="" size="30"/><br> <b>How soon?</b><br> <input name="howsoon" type="text" value="" size="30"/><br> <font size="1">We hate spam too! Your information will only be shared with the doctor.</font> <p align="right"><input type="submit" value="SEND MAIL"/></p> </form> <?php } else /* send the submitted data */ { $name=$_REQUEST['name']; $email=$_REQUEST['email']; $phone=$_REQUEST['phone']; $howsoon=$_REQUEST['howsoon']; if (($name=="")||($email=="")||($phone=="")||($howsoon=="")) { echo "<br><br><font color='red' size='3'>All fields are required, please fill <a href=\"\">the form</a> again.</font><br><br>"; } else{ $from="From: $name<$email>\r\nReturn-path: $email"; $subject="Free Plastic Surgery Consultation Request"; mail("myemailaddress@email.com", $subject, $message, $from); echo "<br /><br /><font color='blue'><b>Form is sent! Thank you for using CelebrityNoseJobs.net to find a Cosmetic/Plastic Surgeon practice in $details->city. We will provide your information to participating specialists in the area and they will get back to you with more information as soon as possiblle.</b></font><br /><br />"; } } ?>
  5. Hello everyone. I am writing this order/feedback form using a php script. Every time i hit submit, the html page (that has the form inside) just reloads and does not perform the script could anyone give me some pointers in my code the form/php? I have made sure they are linked verbatim I am a nube so please forgive my inexperience Here is the form in the html , down below it is the corresponding php code for the form <form action="send_mail.php" method="post"> <table align="left"> <tr> <td> <input type="checkbox" name="food1" value="" /> 1 Fudge Brownie</td> <td><input style="color:#000000" type="number" name="onefudgebrownie" /> </td> </tr> <tr> <td> <input type="checkbox" name="food2" value="" /> 4 Italian Biscotti </td> <td><input style="color:#000000" type="number" name="fouritalianbiscotti" /> </td> </tr> <tr> <td> <input type="checkbox" name="food3" value="" /> 4 Soft & Chewy Chocolate Chip Cookies</td> <td><input style="color:#000000" type="number" name="foursoftchewychocolatechipcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food4" value="" /> 4 Cape Cod Cranberry Oatmeal Cookies</td> <td><input style="color:#000000" type="number" name="fourcapecodcranberryoatmealcookies" /> </td> </tr> <tr> <td> <input type="checkbox" name="food5" value="" /> 1 Loaf of Artisan French Bread. </td> <td><input style="color:#000000" type="number" name="oneloafofartisanfrenchbread" /> </td> </tr> <tr> <td> <input type="checkbox" name="food6" value="" /> 6 Kaiser Deli Rolls </td> <td><input style="color:#000000" type="number" name="sixkaiserdelirolls" /> </td> </tr> <tr> <td> <input type="checkbox" name="food7" value="" /> 6 Soft Hamburger Rolls</td> <td><input style="color:#000000" type="number" name="sixsofthamburgerrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food8" value=""/> 6 5 sub rolls</td> <td><input style="color:#000000" type="number" name="sixfiveinchsubrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food9" value="" /> 12 2" slider rolls</td> <td><input style="color:#000000" type="number" name="twelvetwoinchsliderrolls"/> </td> </tr> <tr> <td> <input type="checkbox" name="food10" value="" /> 4 Snickerdoodle Cookies</td> <td><input style="color:#000000" type="number" name="foursnkickerdoodlecookies"/> </td> </tr> <tr> <td> <input type="checkbox" name="food11" value="" /> 1 Colossal Cinnamon Sticky Bun</td> <td><input style="color:#000000" type="number" name="onecolossalcinnamonstickybun"/> </td> </tr> <tr> <td> <input type="checkbox" name="food12" value="" /> 1 Delicious Whoopie Pie</td> <td><input style="color:#000000" type="number" name="onedeliciouswhoopiepie"/> </td> </tr> <tr> <td> <input type="checkbox" name="food13" value="" /> 4 island coconut macaroons</td> <td><input style="color:#000000" type="number" name="fourislandcoconutmacaroons"/> </td> </tr> <tr> <td>Comments/Special Requests:</td> <td> <textarea rows="10" cols="50" name="comments" style="color:#000000" ></textarea> </td> </tr> </table> <br></br> <!--Shipping info/Personal Info Table --> <h3 align="left"> Shipping Information </h3> <table align="left"> <tr> <td>Last Name:</td> <td> <input style="color:#000000" type="text" name="shippinglastname" value="" maxlength="15" /> </td> <td>First Name:</td> <td> <input style="color:#000000" type="text" name="shippingfirstname" value="" maxlength="10" /> </td> </tr> <td>Telephone/Cell.:</td> <td> <input style="color:#000000" type="text" name="telephonecell" value="" maxlength="100" /> </td> <td>Email Address:</td> <td> <input style="color:#000000" type="text" name="emailaddress" value="" maxlength="100" /> </td> </tr> <tr> <td>Brief description of location on the lake:</td> <td> <textarea rows="10" cols="50" name="breifdescript" style="color:#000000"> </textarea> </td> </tr> <!--SUBMIT BUTTON --> <tr> <td> </td> <td> <input type="submit" value="Submit" style= " background-color:#87D163; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius:6px; color: #fff; font-family: 'Oswald'; font-size: 20px; text-decoration: none; cursor: pointer; border:none; submit:hover { border: none; background:#000000; box-shadow: 0px 0px 1px #777; }" /> </td> </tr> <!--SUBMIT BUTTON end --> </table> </form> PHP code below; <?php /*SET THIS RIGHT BELOW AS THE FORM RECIEVING EMAIL*/ $webmaster_email = "__________@gmail.com"; /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ /* First section of variables are for the Items/Food */ $food1 = $_REQUEST['food1'] ; $onefudgebrownie = $_REQUEST['onefudgebrownie'] ; $food2 = $_REQUEST['food2'] ; $fouritalianbiscotti = $_REQUEST['fouritalianbiscotti'] ; $food3 = $_REQUEST['food3'] ; $foursoftchewychocolatechipcookies = $_REQUEST['foursoftchewychocolatechipcookies'] ; $food4 = $_REQUEST['food4'] ; $fourcapecodcranberryoatmealcookies = $_REQUEST['fourcapecodcranberryoatmealcookies'] ; $food5 = $_REQUEST['food5'] ; $oneloafofartisanfrenchbread = $_REQUEST['oneloafofartisanfrenchbread'] ; $food6 = $_REQUEST['food6'] ; $sixkaiserdelirolls = $_REQUEST['sixkaiserdelirolls'] ; $food7 = $_REQUEST['food7'] ; $sixsofthamburgerrolls = $_REQUEST['sixsofthamburgerrolls'] ; $food8 = $_REQUEST['food8'] ; $sixfiveinchsubrolls = $_REQUEST['sixfiveinchsubrolls'] ; $food9 = $_REQUEST['food9'] ; $twelvetwoinchsliderrolls = $_REQUEST['twelvetwoinchsliderrolls'] ; $food10 = $_REQUEST['food10'] ; $foursnkickerdoodlecookies = $_REQUEST['foursnkickerdoodlecookies'] ; $food11 = $_REQUEST['food11'] ; $onecolossalcinnamonstickybun = $_REQUEST['onecolossalcinnamonstickybun'] ; $food12 = $_REQUEST['food12'] ; $onedeliciouswhoopiepie = $_REQUEST['onedeliciouswhoopiepie'] ; $food13 = $_REQUEST['food13'] ; $fourislandcoconutmacaroons = $_REQUEST['fourislandcoconutmacaroons'] ; /* This second section of variables are for the Shipping/Customer Info*/ $shippinglastname = $_REQUEST['shippinglastname'] ; $shippingfirstname = $_REQUEST['shippingfirstname'] ; $telephonecell = $_REQUEST['telephonecell'] ; $emailaddress = $_REQUEST['emailaddress'] ; $breifdescript = $_REQUEST['breifdescript'] ; /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_REQUEST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "Feedback Form Results", $comments, "From: $email_address" ); header( "Location: $thankyou_page" ); } ?> dessertsondemandorderform.html
  6. I recently changed the PHP code where the submitter receives a receipt, Now they want the submitter to receive it with less fields than what the E-mail goes to. For example the people who get the email from the submitter sees all the fields, but the submitter gets a receipt with different fields. I cannot seem to figure it out. Any help is appreciated. So I receive all this fields name,lastname,email,Phone,ReferredBy. But the submitter receives only these files name,lastname,ReferredBy <?php // OPTIONS - PLEASE CONFIGURE THESE BEFORE USE! $yourEmail = "example1@email,example2@email.com"; // the email address you wish to receive these mails through $yourWebsite = "Application"; // the name of your website $thanksPage = ''; // URL to 'thanks for sending mail' page; leave empty to keep message on the same page $maxPoints = 4; // max points a person can hit before it refuses to submit - recommend 4 $requiredFields = "name,lastname,email,Phone,ReferredBy"; // names of the fields you'd like to be required as a minimum, separate each field with a comma $textlink ='<a href="confirmation.html">Click Here And Take The Next Step</a>.' ; // DO NOT EDIT BELOW HERE $error_msg = array(); $result = null; $requiredFields = explode(",", $requiredFields); function clean($data) { $data = trim(stripslashes(strip_tags($data))); return $data; } function isBot() { $bots = array("Indy", "Blaiz", "Java", "libwww-perl", "Python", "OutfoxBot", "User-Agent", "PycURL", "AlphaServer", "T8Abot", "Syntryx", "WinHttp", "WebBandit", "nicebot", "Teoma", "alexa", "froogle", "inktomi", "looksmart", "URL_Spider_SQL", "Firefly", "NationalDirectory", "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot", "crawler", "www.galaxy.com", "Googlebot", "Scooter", "Slurp", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz"); foreach ($bots as $bot) if (stripos($_SERVER['HTTP_USER_AGENT'], $bot) !== false) return true; if (empty($_SERVER['HTTP_USER_AGENT']) || $_SERVER['HTTP_USER_AGENT'] == " ") return true; return false; } if ($_SERVER['REQUEST_METHOD'] == "POST") { if (isBot() !== false) $error_msg[] = "No bots please! UA reported as: ".$_SERVER['HTTP_USER_AGENT']; // lets check a few things - not enough to trigger an error on their own, but worth assigning a spam score.. // score quickly adds up therefore allowing genuine users with 'accidental' score through but cutting out real spam $points = (int)0; $badwords = array("adult"); foreach ($badwords as $word) if ( strpos(strtolower($_POST['comments']), $word) !== false || strpos(strtolower($_POST['name']), $word) !== false ) $points += 2; if (strpos($_POST['comments'], "http://") !== false || strpos($_POST['comments'], "www.") !== false) $points += 2; if (isset($_POST['nojs'])) $points += 1; if (preg_match("/(<.*>)/i", $_POST['comments'])) $points += 2; if (strlen($_POST['name']) < 3) $points += 1; if (strlen($_POST['comments']) < 15 || strlen($_POST['comments'] > 1500)) $points += 2; if (preg_match("/[bcdfghjklmnpqrstvwxyz]{7,}/i", $_POST['comments'])) $points += 1; // end score assignments foreach($requiredFields as $field) { trim($_POST[$field]); if (!isset($_POST[$field]) || empty($_POST[$field]) && array_pop($error_msg) != "Please fill in all the required fields and submit again.\r\n") $error_msg[] = "Please fill in all the required fields and submit again."; } if (!empty($_POST['name']) && !preg_match("/^[a-zA-Z-'\s]*$/", stripslashes($_POST['name']))) $error_msg[] = "The name field must not contain special characters.\r\n"; if (!empty($_POST['email']) && !preg_match('/^([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+$/i', strtolower($_POST['email']))) $error_msg[] = "That is not a valid e-mail address.\r\n"; if ($error_msg == NULL && $points <= $maxPoints) { $subject = "Payment"; $message = "New applicant: \n\n"; foreach ($_POST as $key => $val) { if (is_array($val)) { foreach ($val as $subval) { $message .= ucwords($key) . ": " . clean($subval) . "\r\n"; } } else { $message .= ucwords($key) . ": " . clean($val) . "\r\n"; } } $message .= "\r\n"; // this means reply to the sender with e-mail and subject. if (strstr($_SERVER['SERVER_SOFTWARE'], "Win")) { $headers = "From: {$_POST['email']}\r\n"; $headers .= "Bcc: $yourEmail\r\n"; $headers .= "Reply-To: {$_POST['email']}\r\n"; } else { $headers = "From: {$_POST['email']}\r\n"; $headers .= "Bcc: $yourEmail\r\n"; $headers .= "Reply-To: {$_POST['email']}\r\n"; } if (mail($_POST['email'],$subject,$message,$headers)) { if (!empty($thanksPage)) { header("Location: $thanksPage"); exit; } else { $result = 'Congratulations! We have received your application. IMPORTANT Click link below'; $disable = true; } } else { $error_msg[] = 'Your mail could not be sent this time. ['.$points.']'; } } else { if (empty($error_msg)) $error_msg[] = 'Your mail looks too much like spam, and could not be sent this time. ['.$points.']'; } } function get_data($var) { if (isset($_POST[$var])) echo htmlspecialchars($_POST[$var]); } ?>
  7. Hey there. I have a website that has been "dumped" in my lap as my programmer has journeyed to greener pastures. We have a small form that collects a little data and supposedly inserts it into the database, but for some reason that data never makes it there. You can get the two pages that contain the code: http://dev.goshensparklingjewelry.com/page_1.txt is the page that the user goes to to insert the data, and http://dev.goshensparklingjewelry.com/page_2.txt is the magic page that makes it happen. Not sure what is going on. When you submit the data, you even get the success page as if it went through alright. There is also a place in there that reads and displays data that is already in there, and that part works as well. thanks!
  8. Hello Php Expert, I need help on my current client project. I have made landing page with contact form which is working fine. But after form submission i want the page to redirect to thanks page.. http://ebusinessbpo.com/cebucallcenter/index.html After submit it should redirect to this page http://ebusinessbpo.com/cebucallcenter/thankyou.html I have tried many things with using header etc..but still no solutions..plz help its urgent... my code as below... <?php /* ============================================== Settings ============================================== */ define("MAILTO" , "jj@xyz.com"); define("SUBJECT" , "xyz- landing page query"); define("ERROR_MESSAGE" , "Error sending your message"); define("SUCCESS_MESSAGE" , "Message Sent"); /* ============================================== Email Sender ============================================== */ /* create email message */ $message = ''; // Name $message .= 'Name : ' . $_POST['name'] . "\r\n"; // Email $message .= 'Email : ' . $_POST['email'] . "\r\n"; // Phone $message .= 'Phone : ' . $_POST['phone'] . "\r\n"; // Address $message .= 'Address : ' . $_POST['address'] . "\r\n"; // Company $message .= 'Company : ' . $_POST['company'] . "\r\n"; function validateEmail($email) { if(preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email)) return true; else return false; } if((strlen($_POST['name']) < 1 ) || (strlen($_POST['email']) < 1 ) || validateEmail($_POST['email']) == FALSE ) { echo( ERROR_MESSAGE ); } else { if( mail( MAILTO , SUBJECT , $message , "From: ".$_POST['name']." <".$_POST['email'].">\r\n" ."Reply-To: ".$_POST['email']."\r\n" ) ) { echo( SUCCESS_MESSAGE ); } else { echo( ERROR_MESSAGE ); } } ?>
  9. Hi guys I'm new to this. I tried to post this yesterday,thought it posted but don't see it today. this is my problem: This is my first try at php.I have a contact form with: First Name, Last Name, Email, Comments, a checkbox for newsletter, and a couple of buttons to reset and to submit. It works but does not send the the comment section or the or the check box. Being my first time working with php I'm stuck, and the band is really needing me to get this done. Any help would be greatly appreciated! Thank you! I did this with dreamweaver. Thanks again! Code Below: <!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>Comments</title> <style type="text/css"> <!-- body,td,th { color: #FFFFFF; } body { background-color: #000000; background-image: url(/mcfunkband/public_html/images/aa_stars.jpg); } --> </style></head> <body> <?php $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $comments = $_POST['comments']; $newsletter = $_POST['newsletter']; //Sending Email to form owner $header = "From: $email\n" . "Reply-To: $email\n"; $subject = "Submission From My Form"; $email_to = "***@****.com"; $message = "name: $fname . $lname\n" . "email: $email\n"; mail($email_to, $subject ,$message ,$header ) ; ?> _______________________________________________________________________________________________ html: _______________________________________________________________________________________________ <form id="form1" name="form1" method="post" action="result.php"> <table width="100%" border="5"> <tr> <td><div align="right"> <label for="fname">First Name:</label> </div></td> <td><div align="left"> <input type="text" name="fname" id="fname" /> </div></td> </tr> <tr> <td><div align="right"> <label for="lname">Last Name:</label> </div></td> <td><div align="left"> <input name="lname" type="text" id="lname" maxlength="25" /> </div></td> </tr> <tr> <td><div align="right"> <label for="email">Emai:l</label> </div></td> <td><div align="left"> <input type="text" name="email" id="email" /> </div></td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left"></div></td> </tr> <tr>
  10. Hey everyone, This is probably something really simple, but i cant seem to figure out how to do this, i want to create a form that once the person has filled out their info (email, name, age, bio...etc) it will send them an email confirmation with a time stamp of when they entered the info. My question is, how the heck do i get php to take the email address they have submitted and send a confirmation to that email address? Im assuming i need to create a variable for the <input> for the email text area? im not so sure though... thank you
  11. I have a html form which is spread over two pages. What is the best way to collect information from the two pages and insert them into a single mysql database? Do I carry the results from the first form over to client_start_2.html and then process the the parts of the form together? Or is best to process the halves of the form seperately somehow? <div id="clientform"> <p>Please enter your details below, and 3 of your local tree surgeons will get in touch! or <a href="login.html">login</a><br /><br/></p> <form action="client_start_2.html" method="post"> <p class="left"><label for="name" class="required">Your Name</label><br> <input class="field required" id="name" name="name" placeholder="Your Name" required tabindex="1" type="text" ></p> <p class="right"><label for="email" class="required">Your Email Address</label><br> <input class="field required" id="email" name="email" placeholder="Your Email Address" required tabindex="1" type="email"></p> <div style="clear:both" /> <p class="left"><label for="phone">Your Phone Number</label><br> <input class="field" id="phone" name="phone" placeholder="Your Phone Number" tabindex="3" type="text"></p> <p class="right"><label for="postcode">Your Full Postcode</label><br> <input class="field" id="postcode" name="postcode" placeholder="Your Full Postcode" tabindex="4" type="text"></p> <div style="clear:both" /> <p class="left"><label for="type" class="required">Type of works</label><br> <select class="dropdown required" id="type" name="type" required="required" tabindex="9"> <option value=""> Please Select </option> <option value="1">Tree Surgery</option> <option value="2">Stump Grinding</option> <option value="3">Tree Surgery and Stump Grinding</option> </select></p> <p class="right"><label for="phone">Ideal Start Date</label><br> <input class="field" id="phone" name="phone" placeholder="Your Phone Number" tabindex="5" type="text"></p> <div style="clear:both"> <p class="left"><label for="question" class="required">Brief Description of Works</label><br> <textarea class="textarea required" id="question" name="question" placeholder="Your Question" required tabindex="10"></textarea></p> <p class="button"><button tabindex="6" type="submit">Submit</button></p> <div style="clear:both" /> </form> and then on client_start_2.html; <div id="clientform"> <p>Nearly there... Please choose a username and password, then were all done! <br/><br/></p> <form action="my-processing-page.php" method="post"> <p><label for="name" class="required">Username</label><br> <input class="field required" id="name" name="name" placeholder="Your Name" required tabindex="1" type="text" ></p> <div style="clear:both" /> <p class="left"><label for="password" class="required">Password</label><br> <input class="field required" id="password" name="password" placeholder="password" required tabindex="2" type="text"></p> <p class="right"><label for="confirm">Confirm Password</label><br> <input class="field" id="confirm" name="confirm" placeholder="confirm password" tabindex="3" type="text"></p> <div style="clear:both" /> <p class="left">Do you agree to the terms and conditions? <br/><input type="radio" value="Yes" name="Yes" > Yes <input type="radio" value="No" name="No"> No </p> <p class="button"><button tabindex="6" type="submit">Submit</button></p> <div style="clear:both" /> </form> Many thanks
  12. What would be the best way to sanitize the simple form below? FILTER_SANITIZE_EMAIL FILTER_VALIDATE_EMAIL (isset($_REQUEST['email'])) Ive seen the above, but to be quite honest im not sure where or how they would go. Ive had a play around but im not getting very far! Any help would be really great! <div id="box"> <?php $con = mysql_connect("userdb,pw"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); $sql="INSERT INTO tablename (name, email) VALUES ('$_POST[name]','$_POST[email]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "Thankyou! We will be in touch soon."; mysql_close($con); ?> </div>
×
×
  • 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.