M
Mr E
Guest
i have three. problems with the following code. the page the code is on is on a basket page, the basket page obviously holds them in session variables but also it displays passed data from order forms. what i would like is for the data rather than to be displayed in a text string as it is in the minute, is to be displayed in a table with door name quantity image and price. currently it displays a text string with the quantity the price of a single door. and the door name.
all the images are stored in a text field in a database which shows the file location that the images are in rather than blob image (MySQL Database).
what i would like is some assistance on ho to
1) the image to be passed accross to the basket page in the same way as are the other $_POST details. as the method i tried strangely displayed a number rather than the image
2) display all the details in a table to make it look professional rather than the text string it is in now
3) to create a total by adding obviously multiplying the quantity by the price and adding all the prices together to get a final price
this is the following code for one of the order pages:
<?php
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// 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,ListPrice50Percd... VAT, InternetDiscount10Perc FROM tblpricelist WHERE DoorName like '%Arbury%'");
$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']."'\"/>
";
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='hidden' name='DoorName' value='".$row['DoorName']."'>";
echo "<input type='hidden' name='price' value='".$row['InternetDiscount10Perc']....
echo "<INPUT type='text' name='Quantity' value='1' size=2 maxlength=2>";
echo "<input type='submit' id='Submitfrm' value='order now' />";
echo "</form>";
echo "</th>";
$cln++;
if ($cln == 4)
{
$cln = 0;
echo ("</tr>\n<tr>");
}
}
echo ("</tr>");
echo ("</table>");
?>
</div>
</div>
this code needs a hidden field for the image, however i have found that it isn't as simple as the other two and i don't know how it would work
this is the following code for the basket page
<?php
// store session data
session_start();
$quantity=$_POST["Quantity"];
$doorname=$_POST["DoorName"];
$price=$_POST["price"];
$image=$_POST["image"];
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$_SESSION [$doorname]= $quantity. "+" . $price. "+" . $image ;
?>
these are the session variables, they have one for the image already there but obviously does nothing at the minute because there isn't a hidden field for the image page on the order page
<div id = "productform">
<?php
foreach ($_SESSION as $key=>$val)
{
$index = stripos($val, "+");
$quantity = substr($val, 0, $index);
$price = substr($val,$index+1);
$image = substr($val,$index+2);
echo "Door type $key has quantity $quantity and price £$price
";
}
echo $_SESSION [""];
$_POST[$DATA_f["DoorName"]];
$_POST[$row['OurListPrice']];
$_POST[$row['Quantity']];
?>
</div>
this is the data that breaks up the session to place into a nice string. this needs to be changed into a table and calculate the final price.
i think i've given you everything you need to assist. hopefully its all you need cause i don't have the points to be contacted or reply.
Cheers
all the images are stored in a text field in a database which shows the file location that the images are in rather than blob image (MySQL Database).
what i would like is some assistance on ho to
1) the image to be passed accross to the basket page in the same way as are the other $_POST details. as the method i tried strangely displayed a number rather than the image
2) display all the details in a table to make it look professional rather than the text string it is in now
3) to create a total by adding obviously multiplying the quantity by the price and adding all the prices together to get a final price
this is the following code for one of the order pages:
<?php
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// 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,ListPrice50Percd... VAT, InternetDiscount10Perc FROM tblpricelist WHERE DoorName like '%Arbury%'");
$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']."'\"/>
";
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='hidden' name='DoorName' value='".$row['DoorName']."'>";
echo "<input type='hidden' name='price' value='".$row['InternetDiscount10Perc']....
echo "<INPUT type='text' name='Quantity' value='1' size=2 maxlength=2>";
echo "<input type='submit' id='Submitfrm' value='order now' />";
echo "</form>";
echo "</th>";
$cln++;
if ($cln == 4)
{
$cln = 0;
echo ("</tr>\n<tr>");
}
}
echo ("</tr>");
echo ("</table>");
?>
</div>
</div>
this code needs a hidden field for the image, however i have found that it isn't as simple as the other two and i don't know how it would work
this is the following code for the basket page
<?php
// store session data
session_start();
$quantity=$_POST["Quantity"];
$doorname=$_POST["DoorName"];
$price=$_POST["price"];
$image=$_POST["image"];
$con = mysql_connect("localhost", "root", "")|| die;
mysql_select_db("protechpricer");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$_SESSION [$doorname]= $quantity. "+" . $price. "+" . $image ;
?>
these are the session variables, they have one for the image already there but obviously does nothing at the minute because there isn't a hidden field for the image page on the order page
<div id = "productform">
<?php
foreach ($_SESSION as $key=>$val)
{
$index = stripos($val, "+");
$quantity = substr($val, 0, $index);
$price = substr($val,$index+1);
$image = substr($val,$index+2);
echo "Door type $key has quantity $quantity and price £$price
";
}
echo $_SESSION [""];
$_POST[$DATA_f["DoorName"]];
$_POST[$row['OurListPrice']];
$_POST[$row['Quantity']];
?>
</div>
this is the data that breaks up the session to place into a nice string. this needs to be changed into a table and calculate the final price.
i think i've given you everything you need to assist. hopefully its all you need cause i don't have the points to be contacted or reply.
Cheers