PHP booking form Query

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
evanleondawod
Forum Newbie
Posts: 8
Joined: Sat Mar 28, 2009 1:04 pm

PHP booking form Query

Post by evanleondawod »

Hey Guys

I am new to php and recently i sat and wrote a code for my fathers website.. It is a booking form and the code that i wrote send me random blank emails... so there must be something up with the code... the code is:

<?php

/* Subject and email variables */

$emailSubject = 'Booking Form';
$webMaster = 'info@lecltd.net';

/* Gathering Data Variables */

$NameField = $_POST['nameField'];
$MobileField = $_POST['telephone'];
$EmailField = $_POST['email'];
$PickupField = $_POST['pickAdd'];
$DropoffField = $_POST['dropAdd'];
$OutdateField = $_POST['outDate'];
$OuttimeField = $_POST['outTime'];
$OutflightField = $_POST['outFlight'];
$OutpassengersField = $_POST['outPassengers'];
$OutLuggageField = $_POST['outLuggage'];
$indateField = $_POST['inDate'];
$intimeField = $_POST['inTime'];
$inflightField = $_POST['inFlight'];
$inpassengersField = $_POST['inPassengers'];
$inLuggageField = $_POST['inLuggage'];

$body = <<<EOD
<br><hr><br>
Name: $nameField <br>
Phone Number: $MobileField <br>
Email: $EmailField <br>
Pick up Address: $PickupField <br>
Drop Off Address: $DropoffField <br>
Outward Date: $OutdateField <br>
Outward Time: $OuttimeField <br>
Outward Flight no: $OutflightField <br>
Outward Passengers: $OutpassengersField <br>
Outward luggage: $OutLuggageField <br>
Inward Date: $indateField <br>
Inward Time: $intimeField <br>
Inward Flight no: $inflightField <br>
Inward Passengers: $inpassengersField <br>
Inward luggage: $inLuggageField <br>
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: tect/hmtl\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

if($success){
echo "Thankyou, We will contact you shortly";
}
else{
echo "Error Please contact us through our contact page, Thank You";
}

?>

I do not undrrstand what i could hve done wrong.. maybe you guys got point me in the right direction...


thanks

Evan
Randwulf
Forum Commoner
Posts: 63
Joined: Wed Jan 07, 2009 7:07 am

Re: PHP booking form Query

Post by Randwulf »

I don't see any problem with that script. Can you show us the one that passes the information to it?

Also, maybe you already did this, but before you mail() it, echo $body and see if it outputs the appropriate information.
evanleondawod
Forum Newbie
Posts: 8
Joined: Sat Mar 28, 2009 1:04 pm

Re: PHP booking form Query

Post by evanleondawod »

the file the information is from is

</head>

<body bgcolor="#000000" text="#FFFFFF" class="style1" style="font-family:'Orator Std'" link="#FFFFFF">
<label></label>
<h1 class="style1" style="font-family:"Orator Std" align="center">London Executive Chauffeurs Ltd Booking Form</h1>
<p align="center">Once you have made your booking we will contact you as soon as possible with a confirmation e-mail</p>
<form id="form1" name="form1" method="post" action="bookformprocess.php">
<p>Name<span class="style1" style="font-family:'Orator Std'"><span class="style1" style="font-family:'Orator Std'">:

</span></span><span class="style1" style="font-family:'Orator Std'"><span class="style1" style="font-family:'Orator Std'">
<input type="text" name="nameField" id="nameField" />
</span></span></p>
<p>Mobile/Tel:
<label>
<input type="text" name="telephone" id="telephone" />
</label>
</p>
<p>E-mail:
<label>
<input type="text" name="email" id="email" />
</label>
</p>
<p>Pick Up Add:
<label></label>
<br />
<textarea name="pickAdd" id="pickAdd2" cols="45" rows="5"></textarea>
</p>
<p>Drop Add:
<label></label>
<br/>
<textarea name="dropAdd" id="dropAdd" cols="45" rows="5"></textarea>
</p>
<p><u>Journey Details - Outward Booking</u> </p>
<p>Booking Date:
<label>
<input type="text" name="outDate" id="outDate" />
</label>
</p>
<p>Time (24hour):
<label>
<input type="text" name="outTime" id="outTime" />
</label>
</p>
<p>Flight No.:
<label>
<input type="text" name="outFlight" id="outFlight" />
</label>
</p>
<p>Passengers:
<label>
<input type="text" name="outPassengers" id="outPassengers" />
</label>
</p>
<p>pieces of Luggage:
<label>
<input type="text" name="outLuggage" id="outLuggage" />
</label>
</p>
<p><u>Return Booking</u></p>
<p>Booking Date:
<label>
<input type="text" name="inDate" id="inDate" />
</label>
</p>
<p>Time (24hour):
<label>
<input type="text" name="inTime" id="inTime" />
</label>
</p>
<p>Flight No.:
<label>
<input type="text" name="InFlight" id="InFlight" />
</label>
</p>
<p>Passengers:
<label>
<input type="text" name="inPassengers" id="inPassengers" />
</label>
</p>
<p>pieces of Luggage:
<label>
<input type="text" name="inLuggage" id="inLuggage" />
<br />
<br />
<br />
</label>
<label>
<input type="submit" name="Submit" id="Submit" value="Submit" />
</label>
</form>
<p align="center">
<a href="index.html">
<label></label>
Back to Homepage</a></p>
</body>
</html>
Post Reply