I am using sessions, but for the life of me I can't get the variable right.
I've been working all day and am pretty tired, there must be something I am missing. would love another pair of eyes on it =)
Code: Select all
<?php
//connect include
require("connect.php");
session_start();
#error_reporting(E_ERROR); //turn off error for session variables
echo "your choosen ride is: " .$_SESSION ['result'];
//extract data
$extract =mysql_query("SELECT * FROM ride WHERE rideID ='3'");
$numrows = mysql_num_rows($extract);
//start of form
echo '<form method="post" name="f1" action="confirm.php">';
echo 'Please choose a seat: ';
echo"<select multiple name='seat' size='2'>";
while( $row = mysql_fetch_assoc($extract))
{
$rideID = $row ['rideID'];
$name = $row ['name'];
$seatNumber = $row ['seatNumber'];
$time = $row ['time'];
$price = $row ['price'];
echo "<option name='seat'> $seatNumber </option>";
$_SESSION['extract']=$_POST['seat'];
# $_SESSION['result']=$_POST['ABC']; //wasc alling blank variable
}
echo '</select><br>';
?>
<?php
require('connect.php');
$extract2 =mysql_query("SELECT * FROM ride WHERE rideID ='3'");
$numrows = mysql_num_rows($extract2);
//start of form
echo '<form method="post" name="f2" action="confirm.php">';
echo 'Please choose a seat: ';echo"<select multiple name='seat2' size='2'>";
while( $row = mysql_fetch_assoc($extract2))
{
$rideID = $row ['rideID'];
$name = $row ['name'];
$seatNumber = $row ['seatNumber'];
$time = $row ['time'];
$price = $row ['price'];
echo "<option name='seat2'> $seatNumber </option>";
$_SESSION['extract2']=$_POST['seat2'];
# $_SESSION['result']=$_POST['ABC']; //was calling blank variable
}
echo '</select><br>';
?>
<?php
#$end =$_POST['endPrice'];
$_SESSION['priceWvat']=$_POST['endPrice'];
echo "<input type='submit' value='Submit'>";
echo "</form>";
//show time and price
echo "The price of the ride is: £$price<br>The duration if of the ride is: $time minutes<br>" ;
#$totalPrice=($_SESSION['extract']+$_SESSION['extract2']);
#echo $totalPrice;
//VAT function
$seatPrice=($price*2);
$vat=17.5;
$priceXvat=0.300;
function vat($vat, $priceXvat)
{
return sprintf("%01.2f", ($vat*$priceXvat/ 100));
}
$vatprice = vat(17.5, 3.00);
$total=($vatprice*2);
$endPrice= ($total+$seatPrice);
//Ftotal
echo "<br>";
echo "The price including VAT is: £ ";echo $endPrice ;
?>
what I am trying to do is add the VAT of two seats costing 3.00, The price is $price from the `ride` table. the VAT needs to go to another page and maybe further, any help?
Thanks.