<?php
include_once("connectDB.php");
if ($_SESSION["loggedin"] != "true")
header("Location : member_login.php");
$aname = $_SESSION["aname"] ;
$aid = $_SESSION["aid"];
$result = mysql_query("select * from member where m_ID = $aid");
$row =mysql_fetch_assoc($result);
$ticketid = $_REQUEST["ticketid"];
// Use this var to check to see if this ID exists, if yes then get the product
$result = mysql_query("select * from ticket where ticketID = $ticketid ");
// get all the product details
while($row = mysql_fetch_assoc($result))
{
$from = $row["ticketFrom"];
$to = $row["ticketTo"];
$date = $row["ticketDate"];
$time = $row["ticketTime"];
$type = $row["ticketType"];
$price = $row["ticketPrice"];
}
if(isset($_POST["book"]))
{
$trip = $_POST["trip"];
$return = $_POST["return"];
$adult = $_POST["adults"];
$children = $_POST["children"];
$infant = $_POST["infants"];
mysql_query("insert into booking (m_ID,bookFrom,bookTo,bookDepart,bookTime,bookClass,bookPrice,bookType,bookReturn,bookAdults,bookChildren,bookInfants)
values ('$aid','$from','$to','$date','$time','$type','$price','$trip','$adult','$return','$adult','$children','$infant')");
?>
<script type ="text/javascript">
alert("Product Have been Add to Cart");
</script>
<?php
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Store Homepage</title>
<link rel = stylesheet href="style/code1.css" type="text/css">
</head>
<body>
<div align="center" id="mainWrapper">
<?php include_once("member_header.php")?>
<div id="pageContent">
<table align="center" width="668px" border="1">
<tr>
<td rowspan="5"><align="center" width="300px" height="500px">
<table align="left" width="500px" height="500px" border="1">
<tr>
<td colspan="2" align="center"><b>Return :</b><input type="radio"name="trip"value="return"checked required="required">
</td>
<td colspan="2" align="center"><b>One Way :</b><input type="radio"name="trip"value="oneway" required="required">
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>From :</b><select name="origin">
<option value="<?php echo $from; ?>"><?php echo $from; ?></option>
</select>
</td>
<td colspan="2" align="center"><b>Destination :</b><select name="destination">
<option value="<?php echo $to; ?>"><?php echo $to; ?></option>
</select>
</td>
</tr>
<tr>
<td colspan ="2" align="center"><b>Depart :</b><input type="date"name="return"size="20" value="<?php echo $date; ?>">
</td>
<td colspan = "2" align="center"><b>Return :</b><input type="date"name="return"size="20"required="required"/>
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>Time :</b><input type="time"value="<?php echo $time; ?>"/>
</td>
<td colspan="2" align="center"><b>Type:<select name="type">
<option value="<?php echo $type; ?>"><?php echo $type; ?></option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>Adults :</b>
<select name="adults" required="required">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</td>
<td colspan ="2" align="center"><b>Children :</b>
<select name="children" required="required">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</td>
<tr>
<td colspan="3" align="center"><b>Infants :</b>
<select name="infants" required="required">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">Price: RM<?php echo $price; ?>
<br><hr style="color:grey;">Adult Price: RM<?php echo $price; ?>
<br><hr style="color:grey;">Children Price: RM<?php echo $price/2 ?>
<br><hr style="color:grey;">Infants Price: RM<?php echo $price/2 ?>
</tr>
<form name="addcart" method="post" action="">
<tr>
<br>
<td colspan="2" rowspan="7" align="center"><input type="submit" name="book" value="Book"><br></td>
</tr>
</form>
</table></div>
<?php include_once("member_footer.php")?>
</div>
</body>
</html>
Jay_3 0 Newbie Poster
Proxet 0 Newbie Poster
Jay_3 0 Newbie Poster
Jay_3 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
Jay_3 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
Jay_3 0 Newbie Poster
pritaeas 2,194 ¯\_(ツ)_/¯ Moderator Featured Poster
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.