ultratek Posted September 24, 2008 Share Posted September 24, 2008 can anyone tell me if this script will email this form: i am new to php ??? <!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>Processing</title> </head> <body> <?php $name = $_REQUEST['name'}: $phone = $_REQUEST['phone'}: $email = $_REQUEST['email'}: $comments = $_REQUEST['comments'}: $to = '[email protected]'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'email' . "\r\n"; mail($to, $name, $phone, $email, $comments, $headers); ?> </body> </html> form: <form action="handle_form.php" method="post"> <fieldset> </p> <legend>Please fill in the form below:</legend> <p><b>Name:</b> <input type="text" name="name" size="20" maxlength="40" /></p> <p><b>Phone:</b> <input type="text" name="phone" size="20" maxlength="40" /></p> <p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength"60" /></p> <p><b class="topright">Comments:</b> <textarea name="comments" cols="40" rows="6"></textarea> </p></fieldset> <input type="submit" name="submit" value="Send Information" /> </form> Link to comment https://forums.phpfreaks.com/topic/125689-email/ Share on other sites More sharing options...
rarebit Posted September 24, 2008 Share Posted September 24, 2008 see this Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-649948 Share on other sites More sharing options...
ultratek Posted September 25, 2008 Author Share Posted September 25, 2008 i revised the script....but i get a 500 internal server error when i try using the script i tried serveral times making some sense from what they tell me in the manual...but why doesn't the script work? <!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>Processing</title> </head> <body> <?php $name = $_REQUEST['name'}: $phone = $_REQUEST['phone'}: $email = $_REQUEST['email'}: $subject = $_REQUEST['subject']; $comments = $_REQUEST['comments'}: $name = "name"; //senders name $email = "email"; //senders e-mail adress $recipient = "[email protected]"; //recipient $comments = "The text for the mail..."; //mail body $subject = "subject"; //subject $header = "From: ". $name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $comments, $phone, $header); //mail command ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-650001 Share on other sites More sharing options...
rarebit Posted September 25, 2008 Share Posted September 25, 2008 Your passing too much, whats your phone field mean to the email function? bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) <?php $name = $_REQUEST['name'}: $phone = $_REQUEST['phone'}: $email = $_REQUEST['email'}: $subject = $_REQUEST['subject']; $comments = $_REQUEST['comments'}: $name = "name"; //senders name $email = "email"; //senders e-mail adress $recipient = "[email protected]"; //recipient $comments = "The text for the mail...".$phone; //mail body $subject = "subject"; //subject $header = "From: ". $name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $comments, $header); //mail command ?> Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-650012 Share on other sites More sharing options...
ultratek Posted September 25, 2008 Author Share Posted September 25, 2008 well i thought it would be nice to have the phone printed on its own line... Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-650017 Share on other sites More sharing options...
rarebit Posted September 25, 2008 Share Posted September 25, 2008 $comments = "The text for the mail...\n\n".$phone; surely thats a cosmetic gripe... Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-650024 Share on other sites More sharing options...
ultratek Posted September 25, 2008 Author Share Posted September 25, 2008 well thank you for your help i revised again and saw i had used curly brackets by accident this is what i have now and i do not get the 500 error but the process php page loads and i get no email <!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>Processing</title> </head> <body> <?php $name = $_REQUEST['name']; $phone = $_REQUEST['phone']; $email = $_REQUEST['email']; $subject = $_REQUEST['subject']; $comments = $_REQUEST['comments']; $name = "name"; //senders name $email = "email"; //senders e-mail adress $recipient = "[email protected]"; //recipient $comments = "comments...\n\n".$phone; $subject = "subject"; //subject $header = "From: ". $name . " <" . $email . ">\r\n"; //optional headerfields mail($recipient, $subject, $comments, $header); //mail command ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/125689-email/#findComment-650035 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.