ive got a box i want to click which will add the product to the basket but i keep gettin the undefined index error
[CODE=php]
<?include("conn info.php")?>
<?session_start ();?>
<html>
<head>
<title>Products </title>
</head>
<link rel="stylesheet " type="text/css" href="style.css "/>
<body background="htt p://i145.photobucke t.com/albums/r224/lucy_lew/backgroundandlo go.jpg" border="0" alt="background img">
<h1>
<a href="login.php ">Home</a>
<a href="search.ph p">Search</a>
<a href="products. php">Products</a>
<a href="basket.ph p">Shopping Basket</a>
<a href="register. php">Register New User</a>
</h1>
</div>
<div id="container" >
<div id="left_conten t">
<div id = "left_text" >
<?
$query="select * FROM products ";
$result=mysql_q uery($query) or die("Couldnt do it");?>
<?$numrows=mysq l_num_rows($res ult);
if ($numrows>0)
{?>
<table border="1">
<?
while($r=mysql_ fetch_array($re sult))
{?>
<form action="basket. php" method="post">
<td><?echo $r["price"];?></td>
<td><?echo $r["productnam e"];?></td>
<td><img src="images/<?echo $r["productima ge"];?>" alt="Image"></td>
<td><input type="submit" value="Add to Basket"><td/>
</form>
</td>
</tr>
<?
}
?>
</table>
<?}
else
{
echo("Nothing Found.");
}
[/CODE]
[code=php]
<?include("conn info.php");?>
<?session_start ();?>
<html>
<link rel="stylesheet " type="text/css" href="style.css "/>
<body background="htt p://i145.photobucke t.com/albums/r224/lucy_lew/backgroundandlo go.jpg" border="0" alt="background img">
<h1>
<a href="login.php ">Home</a>
<a href="search.ph p">Search</a>
<a href="products. php">Products</a>
<a href="basket.ph p">Shopping Basket</a>
<a href="register. php">Register New User</a>
</h1>
<?
$productid=$_PO ST["productid"];
$price=$_POST["price"];
$productname=$_ POST["productnam e"];
$query = "INSERT INTO basket(producti d, price,productna me)
VALUES'$product id','$price','$ productname'" or die("Couldn't") ;
$result=mysql_q uery($query);
?>
Go to Basket:
<a href="showbaske t.php">Go to Basket</a>
</html>
[/CODE]
[CODE=php]
<?include("conn info.php")?>
<?session_start ();?>
<html>
<head>
<title>Products </title>
</head>
<link rel="stylesheet " type="text/css" href="style.css "/>
<body background="htt p://i145.photobucke t.com/albums/r224/lucy_lew/backgroundandlo go.jpg" border="0" alt="background img">
<h1>
<a href="login.php ">Home</a>
<a href="search.ph p">Search</a>
<a href="products. php">Products</a>
<a href="basket.ph p">Shopping Basket</a>
<a href="register. php">Register New User</a>
</h1>
</div>
<div id="container" >
<div id="left_conten t">
<div id = "left_text" >
<?
$query="select * FROM products ";
$result=mysql_q uery($query) or die("Couldnt do it");?>
<?$numrows=mysq l_num_rows($res ult);
if ($numrows>0)
{?>
<table border="1">
<?
while($r=mysql_ fetch_array($re sult))
{?>
<form action="basket. php" method="post">
<td><?echo $r["price"];?></td>
<td><?echo $r["productnam e"];?></td>
<td><img src="images/<?echo $r["productima ge"];?>" alt="Image"></td>
<td><input type="submit" value="Add to Basket"><td/>
</form>
</td>
</tr>
<?
}
?>
</table>
<?}
else
{
echo("Nothing Found.");
}
[/CODE]
[code=php]
<?include("conn info.php");?>
<?session_start ();?>
<html>
<link rel="stylesheet " type="text/css" href="style.css "/>
<body background="htt p://i145.photobucke t.com/albums/r224/lucy_lew/backgroundandlo go.jpg" border="0" alt="background img">
<h1>
<a href="login.php ">Home</a>
<a href="search.ph p">Search</a>
<a href="products. php">Products</a>
<a href="basket.ph p">Shopping Basket</a>
<a href="register. php">Register New User</a>
</h1>
<?
$productid=$_PO ST["productid"];
$price=$_POST["price"];
$productname=$_ POST["productnam e"];
$query = "INSERT INTO basket(producti d, price,productna me)
VALUES'$product id','$price','$ productname'" or die("Couldn't") ;
$result=mysql_q uery($query);
?>
Go to Basket:
<a href="showbaske t.php">Go to Basket</a>
</html>
[/CODE]
Comment