Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'mail()'.

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

  1. Hi, I am using Xampp 3.2.2 and have written script 8.10 below (Page 228) but I just can´t get an e-mail. Everything looks fine but I get no e-mail at all. PIease help! <?php // Script 8.10 - 19_register.php /*This page lets people register for the site in theory*/ //Set the page title and include the header file: define ('TITLE', 'Register'); include ('templates/19_header_v6.html'); //print some introductory text: print '<div id = "leftcontent"> <h2>Registration Form</h2> <p>Register so that you can take advantages of certain features like this, that and the other thing.</p>'; //Check whether the form has been submitted (handle form if): if ($_SERVER['REQUEST_METHOD'] =='POST'){ $problem = false; //Check for each value: if (empty ($_POST['first_name'])){ $problem = TRUE; print '<p class="text--error">Please enter your first name!</p>'; } if (empty ($_POST['last_name'])){ $problem = TRUE; print '<p class="text--error">Please enter your last name!</p>'; } // Change the email validation(from 19_rigister_v11.php file) so that it also checks for a single "at" symbol: if (empty ($_POST['email']) || (substr_count ($_POST['email'], '@')!=1)){ $problem = TRUE; print '<p class="text--error">Please enter your email!</p>'; } //Validate the password: if (empty ($_POST['password1'])){ $problem = TRUE; print '<p class="text--error">Please enter your password!</p>'; } if ($_POST['password1'] != $_POST['password2']){ $problem = TRUE; print '<p class="text--error">Your password did not match your confirmed password!</p>'; } // Check whether a problem occured: if (!$problem){ print '<p>You are now registered!<br />Okay, you are not really registered but ...</p>'; //Send the email: $body = "Thank you, {$_POST['first_name']}, for registering with the J.D. Salinger fan club!"; mail($_POST['email'], 'Registration Confirmation', $body, 'From:me@example.com'); }else{ //Forgot a field print '<p>Please try again!</>'; } /*if (!problem){ // if there weren´t any problems ... print '<p class ="text--success">You are now registered!<br />Okay, you are not really registerd but ...</p>'; //$_POST = []; }else{//Forgot a field: print '<p class = "text--error">Please try again!</p>'; }*/ } // End of handle form if: if ($_SERVER['REQUEST_METHOD'] =='POST'){ ?> <!--Display the form--> <form action="19_register_v12.php" method="post" class="form--inline"> <!-- Create the sticky first name, last name and email inputs--> <p><label for="first_name">First Name: </label><input type="text" name="first_name" size="20" value="<?php if (isset($_POST['first_name'])){ print htmlspecialchars($_POST['first_name']); }?>"></p> <p><label for="last_name">Last Name: </label><input type="text" name="last_name" size="20" value="<?php if (isset($_POST['last_name'])){ print htmlspecialchars($_POST['last_name']); }?>"></p> <p><label for="email">Email Address: </label><input type="email" name="email" size="20" value="<?php if (isset($_POST['email'])){ print htmlspecialchars($_POST['email']); }?>"></p> Password: <input type = "password" name = "password1" size = "20"/><br /><br /> Confirm Password: <input type = "password" name = "password2" size = "20" /><br /><br /> <p><input type="submit" name="submit" value="Register!" class="button--pill"></p> </form> <?php print '</div>'; require ('templates/19_footer_v6.html'); ?>
  2. Hello: Newbie here...I am trying to send a simple email with an image...I do receive the email with all the proper styling and HTML in place but the email does not show the picture. I am using a host(WEBHOSTINGHUB) and PEAR 1.9.5 is installed BUT DO NOT WANT TO USE PEAR AS IT LOOKS A LITTLE CONFUSING. I tried pasting the code here but it won't let me. Is there a shortcut to accomplish this? in the $body of my html I have <img src="http://www.savingenergy.tsbwebdesign.com/pilgrims.png" width="160" height="160" alt="Pic of Pilgrim" /> Thank-you Tom
  3. Larry, I love your books, I have learned more from them than I did from actual classes... LOL Thank you for taking the time to help us out when we run into problems. I appreciate your knowledge. Please excuse my way of asking questions, as I am new and find it a bit difficult to make sense of it all. I am new to PHP. I can build static sites, but PHP syntax messes with me; even my HTML at times.. I am having a heck of a time figuring out why Chapter 11 : Script 11.1 will not function. I have read many forums, searching out possible causes. The script displays, will run, but nothing happens. For instance when submitting, I can see the data populate the URL, but no "thank you" or "error" message appears. The script just hangs (URL never changes, appears to just hang at the below http in browser window bar). URL: (http://localhost/PHPandMySQLBook/ch3Site/email.php? name=Me&email=some%40email.com&comments=TESTING+123+&submit=Send!) The form resets ($_POST = array() ) is working. I have also tried using your script and modifying the email address (using my own) to no avail. I have tested a very simple script locally that works fine. $msg = "First line of text\nSecond line of text"; $msg = wordwrap($msg, 70); mail("my@email.com", "My Subject", $msg); When previewing the above simple script in my browser I receive the email (Mac Mail). I have also attempted to use a remote copy of the script, to no avail. In addition, I have tried MAMP pro to see if Postfix would help the script function: to no avail. I do not believe it is my 'send mail' method at this point. In addition, I have tried changing the php.ini file to include my user/bin/my@email.com, but may not fully understand what it is I am truly doing. Furthermore, I have read appendix A, but it is difficult at best to follow with my newer version of PHP (PHP admin looks completely different). I am a newbie obviously, and could use some help debugging the problem. Or some help in searching the web for a solution. I do not understand 'postfix' or how it may affect my computer if settings are changed. I have stepped away several times to avoid over analyzing, I have rewritten the script, I have used the books script, I have uploaded to my ISP, and tried locally. Nothing seems to work except the above simple script. My next line of thinking is to try an simplify the script adding one little piece at a time until it breaks? You are correct Debugging has a serious learning curve.. Thank you in advance. I am using: DreamWeaver CS6 (in code mode, with Testing Server MAMP, and Remote via FTP all functional) MAMP 3.0.5 PHP VERSION = 5.5.10 Mac OSX Mavericks 10.9.4 My current script: <!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>Contact Me</title> </head> <body> <h1>Contact Me</h1> <?php # Script 11.1 - email.php # DO NOT RELY ON THIS SCRIPT AS HACKERS CAN AND WILL USE IT TO SPAM. RATHER REFER TO FUTURE CHAPTER CHANGES. if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (!empty($_POST['name']) && !empty ($_POST['email']) && !empty ($_POST['comments']) ){ //Create the body $body = "Name: {$_POST['name']}\n\n Comments: {$_POST['comments']}"; //limit line lentgh $body = wordwrap($body, 70); //Send the email mail('my@email.com', 'Contact Form Submission', $body, "FROM: {_POST['email']}"); //This I change to //my email which works for above simple mail() script. //if it worked OK echo '<p><em>Thank you for contactin me. I will reply some day.</em></p>'; //Clear the array $_POST = array(); }else{ //Error message if it didn't work OK. echo '<p style="font-weight: bold; color: #COO">Please fill out the form completely.</p>'; } } ?> <!--Begin the form--> <p>Please fill out this form to contact me.</p> <form action"email.php" method"post"> <p>Name: <input type="text" name="name" size="30" maxlength="60" vlaue="<?php if(isset($_POST['name'])) echo $_POST['name']; ?>" /></p> <p>Email Address: <input type="text" name="email" size="30" maxlength="80" value="<?php if(isset($_POST['email'])) echo $_POST['email']; ?>" /></p> <p>Comments:<textarea name="comments" rows="5" cols="30"><?php if(isset($_POST['comments'])) echo $_POST['comments']; ?> </textarea></p> <p><input type="submit" name="submit" value="Send!" /></p> </form> </body> </html>
×
×
  • Create New...