PHP form submission

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
rwhite35
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Sep 27, 2012 10:55 am

Re: PHP form submission

Post by rwhite35 » Fri Feb 01, 2013 5:01 am

Hi,

You need to close your textarea tag.

Code: Select all

<textarea name="message" rows="5" cols="40"></textarea>
Consider using an email framework, I prefer PEAR. Make sure PEAR::Mail is installed on your server first, however most PHP/apache distro's are installed with PEAR.

reference: http://pear.php.net/package/Mail/redirected

Here is how you implement PEAR::Mail

Code: Select all

//assign path(required) to sendmail in parameter array
//set additional options here, if needed
$params['sendmail_path'] = '/usr/sbin/sendmail';

//instantiate the Mail object
$mail_object =& Mail::factory('sendmail',$params);

//send the mail	
$success = $mail_object->send($address,$headers,$body); //set earlier in script
   if (PEAR::isError($mail_object)) {print($mail_object->getMessage());}
   	if ($success==true){
          $mes="The email successfully sent";
   		header("Location: message.php?mes=$mes");
   	}
      }
Using a framework (like PEAR::Mail) will optimize your email making sure it is "well formed". That means less of your emails will get bounced or dropped due to mail filtering.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 3 guests