www.webdeveloper.com
Results 1 to 2 of 2

Thread: Need help with email form

  1. #1
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856

    Need help with email form

    I have an email form that works just fine. Then I added 3 new fields in the form and I'm wondering how to include them in the email returned by the php file.
    Code:
    $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
    $name = $_POST['name'] ;
    $email = $_POST['email'] ;
    $title = $_POST['title'] ;
    $section = $_POST['section'] ;
    $clinic = $_POST['clinic'] ;
    $comments = $_POST['comments'] ;
    $http_referrer = getenv( "HTTP_REFERER" );
    
    if (!isset($_POST['name'])) {
    	header( "Location: $formurl" );
    	exit ;
    }
    if (empty($name) || empty($email) || empty($comments)) {
       header( "Location: $errorurl" );
       exit ;
    }
    if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
    	header( "Location: $errorurl" );
    	exit ;
    }
    
    if (get_magic_quotes_gpc()) {
    	$comments = stripslashes( $comments );
    }
    
    $messageproper =
    
    	"This message was sent from:\n" .
    	"$http_referrer\n" .
    	"------------------------------------------------------------\n" .
    	"Name of sender: $name\n" .
    	"Email of sender: $email\n" .
    	"Title: $title\n" .
    	"Section Name: $section\n" .
    	"Clinic: $clinic\n" .
    	
    	"------------------------- COMMENTS -------------------------\n\n" .
    	$comments .
    	"\n\n------------------------------------------------------------\n" ;
    
    mail($mailto, $subject, $messageproper,
    	"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );
    header( "Location: $thankyouurl" );
    exit ;
    Email returns Name, email address and comments.....How do I add Title, Section Name, and Clinic in the return email message?
    Best wishes,
    Eye for Video

  2. #2
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Now I can't get the script to kick in the error page response if some form fields are left empty.
    Code:
    $errorurl = "www.cataractvideo.com/cv/physicians/error.html" ;
    What am I missing?
    EfV

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles