Hello all this is my first post and i come to you with a problem which has been bugging me for ages. I am new to php and have been trying to set up a basic website with a shopping cart. Now i have the items all displaying correcting from database etc and i am now having difficulty getting the information into the shopping cart table.
What is the best method of doing so?
So far i have been trying to get the details (name, genre etc) from a variable via the submit button....is this even possible?
Heres my attempt so far...
<?php
$host = ".0.0.";
$user = "1";
$password = "v";
$database = "***";
$getdescription = $_GET ['description'];
echo $getdescription;
//connect to MySQL
$connect = mysql_connect($host, $user, $password )
or die("Hey loser, check your server connection.");
//make sure we're using the right database
mysql_select_db($database);
$query1 = 'SELECT dvd_name, genre, dvdpic_1, price, delivery, availability, release_date, quantity, description, certificate
FROM dvd_table
WHERE dvd_name="'.$getdescription.'";';
echo $dvd_name;
echo $query1;
$getitem = mysql_query($query1)
or die (mysql_error());
$displayitem = mysql_fetch_array($getitem);
extract($displayitem);
echo $getdescription;
echo $price;
echo $delivery;
//while($getdescription == )
//{
//$displayitem = mysql_fetch_array($getitem);
//extract($displayitem);
//echo $price;
//};
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="webcss.css" />
</head>
<body>
<div id="container">
<div id="NavSect">
<a class="Navlist" href="index.htm">Home</a>
<a class="Navlist" href="newreleases.htm">New Releases</a>
<a class="Navlist" href="coming_soon.htm">Coming Soon</a>
<a class="Navlist" href="dvdchart.htm">DVD Chart</a>
<a class="Navlist" href="sale.htm">Sale</a>
<a class="Navlist" href="map.htm">Contact us</a>
<img id= "NavBar" src= "navtst.png"/>
</div>
<div id="SiteSplash">
<img src="splaszbgd1.png " border="0" atl="some text" />
</div>
<div id="SearchSect">
This is the Section Section
</div>
<div id="MainSect">
<div id ="listing_title">
<?php
echo $genre;
echo " -  ";
echo $dvd_name;
?>
</div>
</div>
<div id="TableDisplay">
<?php
echo "<div id='Listing_cert'>";
echo "<img class='cert1' src=$certificate>";
echo "</div>";
?>
<div id="TableDisplay_Picture">
<?php
echo "<img class='pic2' src='$dvdpic_1'></img>";
?>
</div>
<div id="TableDisplay_Details_1">
<?php
echo "<form>";
echo "Our Price: " ;
echo $price;
echo "<br>";
echo "<br>";
echo "Delivery Time: ";
echo $delivery;
echo "<br>";
echo "<br>";
echo "Availability: ";
echo $availability;
echo "<br>";
echo "<br>";
echo "Released Date: ";
echo $release_date;
echo "<br>";
echo "<br>";
echo "</form>";
echo $quantity;
//
echo "<form action='addtocart.php?description={$delivery}' method='get'>";
echo "Quantity: <input type='number' size='10' name='quantity'></input>";
echo "<br />";
echo "<input type='submit' value='Add To Cart'></input>";
echo "</form>";
Any help would be greatly appreciated 🙂