cadenage Posted November 9, 2008 Share Posted November 9, 2008 Hi All, I created a simple contact form using the example in http://nettuts.com/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/, only mine has a comments field. It is working except I can't get it to post the value in my comments field. here's the code. I placed a comment above the 4th "if" statement that I think is setup wrong. any ideas on how to fix it? <?php if ((isset($_POST['name'])) && (strlen(trim($_POST['name'])) > 0)) { $name = stripslashes(strip_tags($_POST['name'])); } else {$name = 'No name entered';} if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) { $email = stripslashes(strip_tags($_POST['email'])); } else {$email = 'No email entered';} if ((isset($_POST['url'])) && (strlen(trim($_POST['url'])) > 0)) { $url = stripslashes(strip_tags($_POST['url'])); } else {$url = 'No URL entered';} //I think this is setup wrong if ((isset($_POST['comments'])) && (strlen(trim($_POST['comments'])) > 0)) { $comment = stripslashes(strip_tags($_POST['comments'])); } else {$comment = 'No comments entered';} ob_start(); ?> <html> <head> <style type="text/css"> </style> </head> <body> <table width="550" border="1" cellspacing="2" cellpadding="2"> <tr bgcolor="#eeffee"> <td>Name</td> <td><?=$name;?></td> </tr> <tr bgcolor="#eeeeff"> <td>Email</td> <td><?=$email;?></td> </tr> <tr bgcolor="#eeffee"> <td>URL</td> <td><?=$url;?></td> </tr> <tr bgcolor="#eeeeff"> <td>Comments</td> <td><?=$comment;?></td> </tr> </table> </body> </html> <? $body = ob_get_contents(); $to = '[email protected]'; $email = '[email protected]'; $fromaddress = "[email protected]"; $fromname = "Online Contact"; require("phpmailer.php"); $mail = new PHPMailer(); $mail->From = $email; $mail->FromName = $name; $mail->AddAddress("[email protected]","Contact"); $mail->WordWrap = 50; $mail->IsHTML(true); $mail->Subject = "Demo Form: Contact form submitted"; $mail->Body = $body; $mail->AltBody = "This is the text-only body"; if(!$mail->Send()) { $recipient = '[email protected]'; $subject = 'Contact form failed'; $content = $body; mail($recipient, $subject, $content, "From: [email protected]\r\nReply-To: $email\r\nX-Mailer: DT_formmail"); exit; } ?> Link to comment https://forums.phpfreaks.com/topic/132021-phpmailer-not-posting-value-in-textarea/ Share on other sites More sharing options...
Mark Baker Posted November 9, 2008 Share Posted November 9, 2008 is your form field called "comments" or "comment"? Link to comment https://forums.phpfreaks.com/topic/132021-phpmailer-not-posting-value-in-textarea/#findComment-686067 Share on other sites More sharing options...
cadenage Posted November 9, 2008 Author Share Posted November 9, 2008 "comments" Link to comment https://forums.phpfreaks.com/topic/132021-phpmailer-not-posting-value-in-textarea/#findComment-686113 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.