sweetpe Posted December 20, 2008 Share Posted December 20, 2008 <?php // $name=$_POST['name']; $email=$_POST['email']; $feedback=$_POST['feedback']; $toaddress = '[email protected]'; // if (stristr($feedback, 'shop')) $toaddress = 'retail@example'.com; else if (stristr($feedback, 'delivery')) $toaddress = '[email protected]'; else if (stristr($feedback, 'bill')) $toaddress = '[email protected]'; // if (!eregi('^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-]+\.[a-zA-Z0-9_\-\.]+$', $email)) { echo 'That is not a valid email address. Please return to the' .' previous page and try again.'; exit; } $subject = 'Feedback from web site'; $mailcontent = 'Customer name: '.$name."\n" .'Customer email: '.$email."\n" ."Customer comments: \n".$feedback."\n"; $fromaddress = 'From: [email protected]'; mail($toaddress, $subject, $mailcontent, $fromaddress); ?> <html> <head> <title>Bob's Auto Parts - Feedback Submitted</title> </head> <body> <h1>Feedback submitted</h1> <p>Your feedback has been sent.</p> </body> </html> Link to comment https://forums.phpfreaks.com/topic/137782-does-anyone-know-what-the-php-program-does/ Share on other sites More sharing options...
aximbigfan Posted December 20, 2008 Share Posted December 20, 2008 It is the handler for a feedback form.. Chris Link to comment https://forums.phpfreaks.com/topic/137782-does-anyone-know-what-the-php-program-does/#findComment-720141 Share on other sites More sharing options...
aseaofflames Posted December 20, 2008 Share Posted December 20, 2008 psuedocode $name = post variable name (i.e. <input name="name">) $email = post variable email $feedback = post variable name $toaddress = '[email protected]'; if shop is in variable feedback then $toaddress = '[email protected]' else if delivery is in variable feedback then $toaddress = '[email protected]'; else if bill is in variable feedback then $toaddress = '[email protected]'; check if variable emailis valid (some string + @ + some string + . + some string) if email is not valid show error message and quit. set mail subject, body, and from address send mail to $toaddress with subject $subject body $mailcontent and from address $fromaddress display html page saying that content was submitted. by the way 'retail@example'.com; should be '[email protected]'; Link to comment https://forums.phpfreaks.com/topic/137782-does-anyone-know-what-the-php-program-does/#findComment-720147 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.