Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'contact form'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 2 results

  1. I am working with the "secure" version of contact form script 12.1 described in "Chapter 12 - Security Methods" (pg. 365) but would like to modify this so that rather than simply printing a thank you message, the user is redirected to a thank you page. I have tried replacing the given script: // Minimal form validation: if (!empty($scrubbed['email'])) { // Create the body: $body = "Name: {$scrubbed['name']}\n\nComments: {$scrubbed['comments']}"; $body = wordwrap($body, 70); // Send the email: mail('XXX@XXX', 'Contact Form Submission', $body, "From: {$scrubbed['email']}"); // Print a message: echo '<p><em>Thank you for contacting me. I will reply some day.</em></p>'; // Clear $_POST (so that the form's not sticky): $_POST = array(); } else { echo '<p style="font-weight: bold; color: #C00">Please enter a valid email address.</p>'; } with modified: // Minimal form validation: if (!empty($scrubbed['email'])) { // Create the body: $body = "Name: {$scrubbed['name']}\n\nComments: {$scrubbed['comments']}"; $body = wordwrap($body, 70); // Send the email: mail('XXX@XXX', 'Contact Form Submission', $body, "From: {$scrubbed['email']}"); // Redirect to thank you page: header("Location: thankyou.htm"); exit(); // Clear $_POST (so that the form's not sticky): $_POST = array(); } else { echo '<p style="font-weight: bold; color: #C00">Please enter a valid email address.</p>'; } ..but get the error: Warning: Cannot modify header information - headers already sent by (output started at /websites..... Reading about this, it seems nothing can be sent to the browser before header is used. But however I try to move things around, I cannot get this to work. Could you advise how/where this redirect should be used within this script? Thank you.
  2. Hi. I'm using xampp 1.8.0 with Windows 7 SP1, 32 bit OS, and coding HTML5 and CSS3. I'm just learning PHP, and I created a contact form for a dentist's Website, so that patients can request appointments. An email should go to the dentist and display the information that the user entered. (I only coded the 'name' and 'description' to be in the email so far, since this is just a test.) I'm using Javascript to check if the patient filled out the form properly, so I didn't use some of the code shown on pg. 332 of the book. There is an error on the first line: Parse error: syntax error, unexpected 'POST' (T_STRING), expecting ']'. Can someone tell me what's wrong? Thanks. <?php if ($_SERVER['REQUEST_METHOD] == 'POST' { body = "Name: ($POST['name']}\n\nComments: {$_POST['description']}"; $body = wordwrap($body, 70); mail('mail@yahoo.com', 'Contact Form Submission', $body, "From: {$_POST['email']}"); echo 'Thank you for your request. A member of our staff will be contacting you shortly.'; $_POST = array(); } ?> <div id="form"> <div id="contain"> <form action="EmailConf.php" method="post"> <table class="form_demo"> <tr> <td> <label>Name</label> </td> <td> <input class="input_full" type="text" id="name" name="name" required="required" /> </td> </tr> <tr> <td><label for="email"> Email </label> </td> <td> <input class="input_full" type="email" id="email" name="email" required="required" /> </td> </tr> <tr> <td> <label for="tel"> Phone </label> </td> <td> <input class="input_full" type="tel" id="tel" name="tel" required="required" /> </td> </tr> <tr> <td><label for="priority_normal"> Priority </label> </td> <td> <input type="radio" name="priority" id="priority_urgent" value="Urgent"> <label for="priority_urgent"> Urgent </label> <input type="radio" name="priority" id="priority_normal" value="Normal" checked="checked"> <label for="priority_normal"> Normal </label> </td> </tr> <tr> <td> <label for="date">Enter a date:</label> </td> <td> <input class="input_xlarge" type="text" id="date" name="date" required="required" /> <script> (function($){ var pickerOpts = { minDate: new Date(), maxDate: "+3m,", showButtonPanel: true, showOn: "button", buttonImage: "images/cal.png", }; $("#date").datepicker(pickerOpts); })(jQuery); </script> </td></tr> <tr><td>Enter a time: </td> <td><input id="time1" name="s2Time1" /> <script type="text/javascript"> $('#time1').ptTimeSelect({ popupImage: 'Select Time' }); </script> </td> </tr> <tr> <td> <label for="description"> Reason for<br /> appointment </label> </td> <td> <textarea id="description" name="description" rows="3" required="required"></textarea> </td> </tr> </table> <hr /> <p class="clearfix"> <input type="submit" value="Submit" class="float_left" /> <input type="reset" value="Reset" class="float_right"> </p> </form>
×
×
  • Create New...