zero-perfoliate
zero-perfoliate

Author Topic: Help With PHP Form Script?  (Read 214 times)

Offline eireann777

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Help With PHP Form Script?
« on: July 23, 2010, 10:14:53 AM »
Hi, all...

I have been using the following script to send form data on my Linux server for some time.  I put it on someone else's server (Linux) and updated all of the form fields, etc and it is not working - upon submitting the form, I get the following errors:


Warning: mail() [function.mail]: Bad parameters to mail() function, mail not sent. in /home/content/29/5234029/html/reg/contact.php on line 50

Warning: Cannot modify header information - headers already sent by (output started at /home/content/29/5234029/html/reg/contact.php:50) in /home/content/29/5234029/html/reg/contact.php on line 64



The script is:


<?php $to = "email@email.com";

$subject = "New Attendees";

$attendee1 = $_REQUEST['attendee1'];

$course1 = $_REQUEST['course1'];

$email1 = $_REQUEST['email1'];

$attendee2 = $_REQUEST['attendee2'];

$course2 = $_REQUEST['course2'];

$email2 = $_REQUEST['email2'];

$attendee3 = $_REQUEST['attendee3'];

$course3 = $_REQUEST['course3'];

$email3 = $_REQUEST['email3'];

$message = $_REQUEST['message'];

$headers= " From: $email1 \n";

$totalmessage = "

   Attendee 1:   $attendee1 \n

   Course:      $course1 \n

   Email:      $email1 \n

   Attendee 2:      $attendee2 \n

   Course:      $course2 \n

   Email:      $email2 \n

   Attendee 3:      $attendee3 \n

   Course:      $course3 \n

   Email:      $email3 \n

   Comments:      $message \n";


$sent = mail($to, $subject, $headers, $totalmessage);

if ($sent) {        ob_start();


        header("Location: http://www.mywebsite.com/TESTDUMP/thanks.html");

        ob_flush();

} else {       

     ob_start();


        header("Location: http://www.mywebsite.com/TESTDUMP/oops.html");

        ob_flush();

}

?>


Does anyone have any ideas?

Thanks in advance!

~Erin

Offline eireann777

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Re: Help With PHP Form Script?
« Reply #1 on: July 23, 2010, 11:01:11 AM »
I cleaned up the code a bit (below).  It still works on my server, but not the one I need it to work on! Help!


Code: [Select]
<?php 

$to 
"email@email.com"

$subject "New Attendees"

$attendee1 $_REQUEST['attendee1'];

$course1 $_REQUEST['course1'];

$email1 $_REQUEST['email1'];

$attendee2 $_REQUEST['attendee2'];

$course2 $_REQUEST['course2'];

$email2 $_REQUEST['email2'];

$attendee3 $_REQUEST['attendee3'];

$course3 $_REQUEST['course3'];

$email3 $_REQUEST['email3'];

$message $_REQUEST['message']; 

$totalmessage "

   Attendee 1:   $attendee1 \n

   Course:      $course1 \n

   Email:      $email1 \n

   Attendee 2:      $attendee2 \n

   Course:      $course2 \n

   Email:      $email2 \n

   Attendee 3:      $attendee3 \n

   Course:      $course3 \n

   Email:      $email3 \n

   Comments:      $message \n"
;


$sent mail($to$subject$totalmessage);

if (
$sent) {        

        
header("Location: http://www.mywebsite.com/TESTDUMP/thanks.html");



else {        

        
header("Location: http://www.mywebsite.com/TESTDUMP/oops.html");



?>