passing data accross to a shopping basket page and using session variables to

  • Thread starter Thread starter Mr E
  • Start date Start date
M

Mr E

Guest
keep them there using PHP? i'm trying to send selected fields accross from an order page to a shopping basket page using PHP but nothing seems to be passed accross and i don't know why. also my code for session variables is not working. the code was taken from the W3C tutorials with very little change.

this is the code for the products page

<?php

$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}


// some code

// gathers the door name the final price and the thumbnail for all doors that have Arbury in their name
$sql = mysql_query("SELECT DoorName, Thumbimage,OurListPrice,ListPrice50Percdisc, VAT, InternetDiscount10Perc FROM tblpricelist WHERE DoorName like '%Winslow%'");

$cln = 0;
echo ("<table>");
echo ("<tr>");
while ($row = mysql_fetch_array($sql))
{
echo ("<th align=\"center\">");

$id = $row['DoorName'];
echo '<form action="basket.php" method="post">';
echo" <img src='./thumb/". $row['Thumbimage']."' onclick=\"this.src='./large/". $row['Thumbimage']."'\" ondblclick=\"this.src='./thumb/". $row['Thumbimage']."'\"/><br />";
echo $row['DoorName']."<br/>";
echo "full price: £".$row['OurListPrice']."<br/>";
echo "50% discount: £". $row['ListPrice50Percdisc']."<br/>";
echo "We pay the VAT: £". $row['VAT']."<br/>";
echo "and with our online discount you will pay: £".$row['InternetDiscount10Perc']."<br/>";
echo "Quantity:";
echo "<INPUT type='text' name='". $row['DoorName']."' size=2 maxlength=2>";
echo "<input type='submit' value='order now' />";
echo "</form>";


echo "</th>";

$cln++;
if ($cln == 4)
{
$cln = 0;
echo ("</tr>\n<tr>");
}
}


echo ("</tr>");
echo ("</table>");

?>
</div>
</div>
________________________________________________________
this is the code for the shopping basket page


<?php
// store session data
session_start();

if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;

else
$_SESSION['views']=1;
echo "Views=". $_SESSION['views'];

?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<script type="text/javascript" src="finaltestjava.js">
</script>
<script type="text/javascript" src="validateform.js">
</script>
<link rel="stylesheet" type="text/css" href="sitestyle.css" />
<title>Welcome To Protech</title>
</head>
<body >
<div id="Title">
<div id="discount1"></div>
<div id="discount2"></div>
</div>
<div id="MainContent">
<div id = "productform">
<?php

$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

$sql = mysql_query("SELECT DoorName, OurListPrice FROM tblpricelist WHERE DoorName like '%Kenilworth%'");
$sql = mysql_query("SELECT DoorName, OurListPrice FROM tblpricelist WHERE DoorName like '%Kenilworth%'");


$_POST[$row['DoorName']];
$_POST[$row['OurListPrice']];
$_POST[$row['Quantity']];

?>

echo "Quantity:";
?>


</div>
________________________________________________________

this is the error message i'm getting from the session variables (i do not get an error message for passing data accross



Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\xampp\htdocs\FinalTest\basket.php:9) in C:\xampp\htdocs\FinalTest\basket.php on line 25

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\FinalTest\basket.php:9) in C:\xampp\htdocs\FinalTest\basket.php on line 25
Views=1


if you could tell me how to fix this i'd be greatful

if you could also get the session variables to be placed in a table as things are bought just for display purposes i'd be greatful
 
Back
Top