PHP with HTML Form

software development

#1
Air Road
Date of Departure:
Number of Guests:

Room Desired

Single
Double
Twin
Any

Smoking
Non Smoking

Comments and Messages: Share your thoughts with us or ask your questions here.

</FORM}

and here is the PHP code…(act_sendMail.php)
Code:

{?
$emailMsg[ ‘to’ ] = 'matt.c@aptalaska.net ';
$emailMsg[ ‘from’ ] = ‘reservation@thunderbird-motel.com’;
$emailMsg[ ‘subject’ ] = ‘New Contact Request’;

$emailMsg[‘body’] .= "\nType of Contact Request: ".$_POST[‘type’ ];
$emailMsg[ ‘body’ ] .= "\nName: ".$_POST[ ‘name’ ];
$emailMsg[ ‘body’ ] .= "\nEmail Address: ". $_POST[ ‘email’ ];
$emailMsg[ ‘body’ ] .= "\nMailing Address: ". $_POST[ ‘address’ ];
$emailMsg[ ‘body’ ] .= "\n ". $_POST[ ‘address2’ ];
$emailMsg[ ‘body’ ] .= "\nPhone Number: ". $_POST[ ‘phone’ ];
$emailMsg[ ‘body’ ] .= "\n\nArriving: ". $_POST[ ‘arrival_date’ ]. “, at " . $_POST[ ‘arrival_time’ ] .” Via ". $_POST[ ‘transport’ ];
$emailMsg[ ‘body’ ] .= "\nDeparting: ". $_POST[ ‘departure_date’ ];
$emailMsg[ ‘body’ ] .= "\nNumber of Guests: ". $_POST[ ‘guests’ ];
$emailMsg[ ‘body’ ] .= "\nRoom Preference: “. $_POST[ ‘room’] .” - ". $_POST[ ‘smoking’ ];
$emailMsg[ ‘body’ ] .= "\n\nComments: " . $_POST[ ‘comments’ ];

$mailSuccess = mail( $emailMsg[ ‘to’ ], $emailMsg[ ‘subject’ ], $emailMsg[ ‘body’ ]);

if( $mailSuccess ){
?>

<? }else{ ?> <? } ?} Any help would be awesome, thanks in advance! The way its working -Scurred.

#2

Your HTML appears to be incomplete. It desperately needs fixing (close elements, quote attribute values) and validation. Your PHP appears to lack a proper opening tag. I recommend that you read these:

  1. PHP Form Processing
  2. PHP mail()

si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

wow, apparently I didn’t look at the post well enough when i posted it…like my whole problem wasn’t in the post…

anyways after reading through your suggestions I found most of what I needed to find except this:

How can I make the “reply-to” header contain the email address posted in the form? I read that this isn’t a good idea(leads to email injection), and was wondering if there should still be a way to do it…I’ll keep looking!

thanks for the advice, any more would be greatly apreciated!


#4

Here’s an example from the PHP website that includes “reply to”, but beware of injection:[code]<?php
$to = ‘nobody@example.com’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From: webmaster@example.com’ . “\r\n” .
‘Reply-To: webmaster@example.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();

mail($to, $subject, $message, $headers);
?>[/code]--------
si-blog | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]