i dont have any idea how to send through email

i have a sample ticket. i dont know if i'm going to convert the php file into pdf..

i have no idea exactly..

if ever its hard, how can i send the sample ticket through inputted email of a customer...

Recommended Answers

All 6 Replies

i dont have any idea how to send through email

i have a sample ticket. i dont know if i'm going to convert the php file into pdf..

i have no idea exactly..

if ever its hard, how can i send the sample ticket through inputted email of a customer...

There's a great bit of code out there for doing just what you are wanting it to do. It's now located in the google code labs, and can be found here:

http://code.google.com/p/dompdf/

My 2¢. Hope this helps.

are there any other options?

like, sending the php page???

Could you post what a sample ticket looks like?

Here's what it looks like.. its a table of our sample ticket... please help me.. tnx in advance..

<?php
		$db=mysql_connect('localhost', 'root', '');

		if ($dbc=mysql_connect('localhost','root','')){
			if(!mysql_select_db('bus')){
			die ('could not select the database because:'.mysql_error());
			}
		}
		else {
			die ('could not select the database because:'.mysql_error());
		}

		$res=mysql_query("SELECT * FROM customer WHERE ReservationID='{$_REQUEST['ReservationID']}'", $db);


		$Name = "";

		while($row = mysql_fetch_array($res) )
		{
			$ReservationID=$row['ReservationID'];
			$TempID=$row['IDTemp'];
			$ages .= $row['Age'] . ",";
			$names .= $row['Name'] . ",";
			$contacts .= $row['Contact'] . ","; 
			$Address=$row['Address'];
			$Age=$row['Age'];
			$Contact=$row['Contact'];
			$Email=$row['Email'];
			$DateReserved=$row['DateReserved'];
			$Company=$row['Company'];
			$BusNo=$row['BusNo'];
			$Busfrom=$row['Busfrom'];
			$Busto=$row['Busto'];
			$DepDate=$row['DepDate'];
			$ArrDate=$row['ArrDate'];
			$Seats=$row['Seats'];
			$NoSeats=$row['NoSeats'];
			$Price=$row['Price'];
			$Total=$row['Total'];
			$TimeDest=$row['TimeDest'];
			$TimeADest=$row['TimeADest'];
			$BusType=$row['BusType'];
		}
?>
<html>
<head>
<link href="style/ticket_style.css" rel="stylesheet" type="text/css" media="print">
<title>Buckle Up - Online Reservation System</title>
</head>
<body>
<div id="templatemo_content_wrapper">
<div id="templatemo_content">

<center>

<table border="1" width="800">
	<tr>
		<td rowspan="3" align=center>
			<img src="images/grayscale.jpg" width="179" height="97">
			<img src="images/grayscale1.jpg" width="320" height="60">
		</td>
		<td align=center bgcolor=#FFFFFF><b><font size="2" face="arial">Reservation No.</font></b></td>
		
	</tr>
	<tr align=center>
		<td height="27"><font face="arial" size="2"><?php echo $ReservationID;?></font></td>
		
	</tr>

	<tr align="center">
		<td bgcolor=#FFFFFF><b><font size="2" face="arial">Date & Time Issued</font></b></td>
	</tr>
	<tr align="center">
		<td ><font size="2" face="arial"> J.P. Rizal Ext. West Rembo, Makati City</font></td>
		<td><font size="2" face="arial">
			<?php
			date_default_timezone_set('Asia/Manila');
			echo $DateReserved; echo "<br>"; print date("h:i A");
			?>

			</font></td>
	</tr>
</table>
	<font face="arial">
<table border="1" width="800">
	<tr>
		<td colspan="4" bgcolor="#FFFFFF"><font size="3"><b>PASSENGER DETAILS</b></font></td>
	</tr>
	<tr>
		<td><font size="2">Name</font></td>
		<td colspan="3"><font size="2"><?php echo $names;?></font></td>
	</tr>
	<tr>
		<td><font size="2">Address</font></td>
		<td width="65%" colspan="3"><font size="2"><?php echo $Address;?></font></td>
	</tr>
	<tr>
		<td width="31%"><font size="2">Age</font></td>
		<td width="28%"><font size="2"><?php echo $ages;?></font></td>
		<td width="20%"><font size="2">Contact No.</font></td>
		<td width="35%"><font size="2"><?php echo $contacts;?></font></td>

	</tr>
	<tr>
		<td width="15%" ><font size="2">Email</font></td>
		<td width="22%" colspan=4><font size="2"><?php echo $Email;?></font></td>
	</tr>
</table>

<table border="1" width="800">
	<tr>
		<td colspan="6" bgcolor="#FFFFFF"><b><font size="3">TRIP DETAILS</font></b></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus Company</font></td>
		<td colspan="5"><font size="2"><?php echo $Company ?></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus Type</font></td>
		<td colspan="5"><font size="2"><?php echo $BusType;?></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus No.</font></td>
		<td colspan="5"><font size="2"><?php echo $BusNo;?></font></td>
	</tr>
	<tr>
		<td height="24" width="20%"><font size="2">Seat No(s)</font></td>
		<td height="24" colspan="5"><font size="2"><?php echo $Seats;?></font></td>
	</tr>
	<tr>
		<td colspan="3" bgcolor="#FFFFFF"> <font size="2"><b>Departure</b></font></td>
		<td colspan="3" bgcolor="#FFFFFF"><font size="2"><b>Arrival</b></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">From</font></td>
		<td width="16%"><font size="2">Date</font></td>
		<td width="13%"><font size="2">ETD</font></td>
		<td width="18%"><font size="2">To</font></td>
		<td width="15%"><font size="2">Date</font></td>
		<td width="13%"><font size="2">ETA</font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2"><?php echo $Busfrom;?></font></td>
		<td width="16%"><font size="2"><?php echo $DepDate;?></font></td>
		<td width="13%"><font size="2"><?php echo $TimeDest;?></font></td>
		<td width="18%"><font size="2"><?php echo $Busto;?></font></td>
		<td width="15%"><font size="2"><?php echo $ArrDate;?></font></td>
		<td width="13%"><font size="2"><?php echo $TimeDest;?></font></td>
	</tr>
</table>

<table border=1 width=800>
	<tr>
		<td width="51%"><font size="2">No. of Seats Reserved</font></td>
		<td><font size="2"><?php echo $NoSeats;?></td>
	</tr>
	<tr>
		<td width="51%"><font size="2">Price per Seat</font></td>
		<td><font size="2"><?php echo $Price;?></td>
	</tr>
	<tr>
		<td width="51%"><font size="2">Reservation Fee</font></td>
		<td><font size="2"><?php echo $_REQUEST['fee'];?></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Total</font></td>
		<td><font size="2"><?php echo $Total;?></td>
	</tr>
</table>
<br>
<table border=1 width=800>
	<tr>
		<td colspan="6" bgcolor="#FFFFFF"><b><font size="3">Note</font></b></td>
	</tr>
	<tr>
		<td colspan="6" width="51%"><font size="2">Kindly present the printed ticket to Bayad Center for the payment.</font></td>

	</tr>
	<tr>
		<td colspan="6" height=30><font size="2">Upon payment, please bring a valid ID.</font></td>
	</tr>

</table><br>
<table border=1 width=800>
	<tr>
		<td colspan="6" bgcolor=#FFFFFF><b><font size="3">Bayad Center Print Validation</font></b></td>
	</tr>
	<tr>
		<td colspan="6" height="100"><b><font size="3"></font></b></td>
	</tr>


</table>

<div id="hidethis">
<br>
<img src=images/print_icon.gif width=60 height=60 onClick="window.print()">

<br><br>
<a href="index.php">Back to Home</a>
</div>
</center>
</div>
</div>
</body>
</html>

Let's see here:

<?php
		$db=mysql_connect('localhost', 'root', '');

		if ($dbc=mysql_connect('localhost','root','')){
			if(!mysql_select_db('bus')){
			die ('could not select the database because:'.mysql_error());
			}
		}
		else {
			die ('could not select the database because:'.mysql_error());
		}

		$res=mysql_query("SELECT * FROM customer WHERE ReservationID='{$_REQUEST['ReservationID']}'", $db);


		$Name = "";

		while($row = mysql_fetch_array($res) )
		{
			$ReservationID=$row['ReservationID'];
			$TempID=$row['IDTemp'];
			$ages .= $row['Age'] . ",";
			$names .= $row['Name'] . ",";
			$contacts .= $row['Contact'] . ","; 
			$Address=$row['Address'];
			$Age=$row['Age'];
			$Contact=$row['Contact'];
			$Email=$row['Email'];
			$DateReserved=$row['DateReserved'];
			$Company=$row['Company'];
			$BusNo=$row['BusNo'];
			$Busfrom=$row['Busfrom'];
			$Busto=$row['Busto'];
			$DepDate=$row['DepDate'];
			$ArrDate=$row['ArrDate'];
			$Seats=$row['Seats'];
			$NoSeats=$row['NoSeats'];
			$Price=$row['Price'];
			$Total=$row['Total'];
			$TimeDest=$row['TimeDest'];
			$TimeADest=$row['TimeADest'];
			$BusType=$row['BusType'];
		}
$mycontent = <<<EOD
?>
<html>
<head>
<link href="style/ticket_style.css" rel="stylesheet" type="text/css" media="print">
<title>Buckle Up - Online Reservation System</title>
</head>
<body>
<div id="templatemo_content_wrapper">
<div id="templatemo_content">

<center>

<table border="1" width="800">
	<tr>
		<td rowspan="3" align=center>
			<img src="images/grayscale.jpg" width="179" height="97">
			<img src="images/grayscale1.jpg" width="320" height="60">
		</td>
		<td align=center bgcolor=#FFFFFF><b><font size="2" face="arial">Reservation No.</font></b></td>
		
	</tr>
	<tr align=center>
		<td height="27"><font face="arial" size="2"><?php echo $ReservationID;?></font></td>
		
	</tr>

	<tr align="center">
		<td bgcolor=#FFFFFF><b><font size="2" face="arial">Date & Time Issued</font></b></td>
	</tr>
	<tr align="center">
		<td ><font size="2" face="arial"> J.P. Rizal Ext. West Rembo, Makati City</font></td>
		<td><font size="2" face="arial">
			<?php
			date_default_timezone_set('Asia/Manila');
			echo $DateReserved; echo "<br>"; print date("h:i A");
			?>

			</font></td>
	</tr>
</table>
	<font face="arial">
<table border="1" width="800">
	<tr>
		<td colspan="4" bgcolor="#FFFFFF"><font size="3"><b>PASSENGER DETAILS</b></font></td>
	</tr>
	<tr>
		<td><font size="2">Name</font></td>
		<td colspan="3"><font size="2"><?php echo $names;?></font></td>
	</tr>
	<tr>
		<td><font size="2">Address</font></td>
		<td width="65%" colspan="3"><font size="2"><?php echo $Address;?></font></td>
	</tr>
	<tr>
		<td width="31%"><font size="2">Age</font></td>
		<td width="28%"><font size="2"><?php echo $ages;?></font></td>
		<td width="20%"><font size="2">Contact No.</font></td>
		<td width="35%"><font size="2"><?php echo $contacts;?></font></td>

	</tr>
	<tr>
		<td width="15%" ><font size="2">Email</font></td>
		<td width="22%" colspan=4><font size="2"><?php echo $Email;?></font></td>
	</tr>
</table>

<table border="1" width="800">
	<tr>
		<td colspan="6" bgcolor="#FFFFFF"><b><font size="3">TRIP DETAILS</font></b></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus Company</font></td>
		<td colspan="5"><font size="2"><?php echo $Company ?></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus Type</font></td>
		<td colspan="5"><font size="2"><?php echo $BusType;?></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Bus No.</font></td>
		<td colspan="5"><font size="2"><?php echo $BusNo;?></font></td>
	</tr>
	<tr>
		<td height="24" width="20%"><font size="2">Seat No(s)</font></td>
		<td height="24" colspan="5"><font size="2"><?php echo $Seats;?></font></td>
	</tr>
	<tr>
		<td colspan="3" bgcolor="#FFFFFF"> <font size="2"><b>Departure</b></font></td>
		<td colspan="3" bgcolor="#FFFFFF"><font size="2"><b>Arrival</b></font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">From</font></td>
		<td width="16%"><font size="2">Date</font></td>
		<td width="13%"><font size="2">ETD</font></td>
		<td width="18%"><font size="2">To</font></td>
		<td width="15%"><font size="2">Date</font></td>
		<td width="13%"><font size="2">ETA</font></td>
	</tr>
	<tr>
		<td width="20%"><font size="2"><?php echo $Busfrom;?></font></td>
		<td width="16%"><font size="2"><?php echo $DepDate;?></font></td>
		<td width="13%"><font size="2"><?php echo $TimeDest;?></font></td>
		<td width="18%"><font size="2"><?php echo $Busto;?></font></td>
		<td width="15%"><font size="2"><?php echo $ArrDate;?></font></td>
		<td width="13%"><font size="2"><?php echo $TimeDest;?></font></td>
	</tr>
</table>

<table border=1 width=800>
	<tr>
		<td width="51%"><font size="2">No. of Seats Reserved</font></td>
		<td><font size="2"><?php echo $NoSeats;?></td>
	</tr>
	<tr>
		<td width="51%"><font size="2">Price per Seat</font></td>
		<td><font size="2"><?php echo $Price;?></td>
	</tr>
	<tr>
		<td width="51%"><font size="2">Reservation Fee</font></td>
		<td><font size="2"><?php echo $_REQUEST['fee'];?></td>
	</tr>
	<tr>
		<td width="20%"><font size="2">Total</font></td>
		<td><font size="2"><?php echo $Total;?></td>
	</tr>
</table>
<br>
<table border=1 width=800>
	<tr>
		<td colspan="6" bgcolor="#FFFFFF"><b><font size="3">Note</font></b></td>
	</tr>
	<tr>
		<td colspan="6" width="51%"><font size="2">Kindly present the printed ticket to Bayad Center for the payment.</font></td>

	</tr>
	<tr>
		<td colspan="6" height=30><font size="2">Upon payment, please bring a valid ID.</font></td>
	</tr>

</table><br>
<table border=1 width=800>
	<tr>
		<td colspan="6" bgcolor=#FFFFFF><b><font size="3">Bayad Center Print Validation</font></b></td>
	</tr>
	<tr>
		<td colspan="6" height="100"><b><font size="3"></font></b></td>
	</tr>


</table>

<div id="hidethis">
<br>
<img src=images/print_icon.gif width=60 height=60 onClick="window.print()">

<br><br>
<a href="index.php">Back to Home</a>
</div>
</center>
</div>
</div>
</body>
</html>
<?php
EOD;

$to = $row['Email'];
$subject = "Your reservation.";
$headers = 'From: your.email@this.spot' . "\r\n" .
   'Reply-To: your.email@this.spot' . "\r\n" .
   'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $mycontent, $headers);

Remember that you will need to make ALL of your links literal, even to images and stylesheets, like:

<link href="http://www.yoursite.com/style/ticket_style.css" rel="stylesheet" type="text/css" media="print">

not

<link href="style/ticket_style.css" rel="stylesheet" type="text/css" media="print">

My 2¢. Hope this helps.

I've tried youre code.. but its not working..

i've change your $to = $row;

to $to = $Email;


Its not sending emails..

also, i've turned on mercury

tnx

how can i send money to you..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.