wazza Posted April 24, 2010 Share Posted April 24, 2010 hay I have im having trouble creating a shopping basket where i can add and remove items i have created a search and a add button however i am struggling to create the rest the code i have search's all the DVD's i have in store puts the information in table format and i have check boxes at the end of each item. but i do not know hot to link my checkbox's so that they add the item to my basket in the data base taking the users id , name and barcode and name of the item. The code that i have to search all DVD's in my data base its below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <LINK rel="stylesheet" href="MyStyle.css" type="text/css"> </head> <body> <center> <table width="850px" border="0" cellspacing="0"cellpadding="5"> <tr> <td class="left" valign="top" rowspan="5"> <h1> Aston </h1></td> <td class="top" colspan="5" height="60px"><h1> DVD Store</h1></td> </tr> <tr> <td class="grey" colspan="5"></td> </tr> <tr> <td class="links"> <a href="homepage.html"> Home </a></td> <td class="links"> <a href="residential_lettings.html"> Residential Lettings </a> </td> <td class="links"> <a href="enquiries.html"> Enquiries </a> </td> <td class="links"> <a href="references.html"> References </a> </td> <td class="links"> </td> </tr> <tr> <td class="text" colspan="5" align="center"> <h1><br>Search all DVD's</br></h1> <form action="basket.php" method="post"> <p><input type="submit" name="submit" value="Go to Basket" onClick="window.location.href="add DVD.php""/></p> </form> <br> <form action="search.php" method="post"> <input type="submit" value="Back to search" onClick="window.location.href="search.php""> </form> <?php require_once ("mysql_connect.php"); ///$genre = $_POST["genre"]; // Make the query. $query = "select * from dvd order by DVDname"; //run the query $result = mysql_query($query); echo "Search Results<br/>"; echo "<table border='1' cellpadding ='10'> <tr> <th>Barcode</th> <th>Dvd Title</th> <th>Genre</th> <th>Price</th> <th>Quantity</th> <th>Add to Basket</th> <th>Add to Basket</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['barcode'] . "</td>"; echo "<td>" . $row['DVDname'] . "</td>"; echo "<td>" . $row['genreName'] ."</td>"; echo "<td>"."£" . $row['price'] . "</td>"; echo "<td>". $row['quantity'] . "</td>"; echo "<td>"."<form action='add DVD.php'> <input type='submit' name='DVD' value='Add' > </form>"."</td>"; echo "<td>"."<form method='POST'action= 'add DVD.php'><input type='checkbox' name='addtobasket' value='Add to Basket' />"; echo "</tr>"; } echo "</table>"; mysql_close(); ?> <!--<!--echo'<td class="text" width="10%" height="20">'<a href="basket1.php? action=addDVD & barcode= $row["barcode"];&quantity=1">Add Item</a>'</td>*/--> <br> <br> </tr> <!--echo "Quantity: ". $row["Quantity"] ."<br/>";--> <br> </td> </tr> <tr> <td class="footer" colspan="6"><b>© Aston DVD Store </b> <font style="color=#666666; font-size=10;">The Aston Triangle, Birmingham, West Midlands B4 7EJ</font></td> </tr> </table> </center> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/199621-help-creating-a-shopping-basket-with-php-mysql-and-html/ Share on other sites More sharing options...
fenway Posted April 26, 2010 Share Posted April 26, 2010 I can see you're new here -- you might want to re-read the rules. Quote Link to comment https://forums.phpfreaks.com/topic/199621-help-creating-a-shopping-basket-with-php-mysql-and-html/#findComment-1048548 Share on other sites More sharing options...
svgmx5 Posted April 26, 2010 Share Posted April 26, 2010 agree with fenway... So i'll be nice and ask..are you getting any errors? if so please post them so we can see... I can help you with t his, since i had this same issue, but i need to know what errors you are getting if any Quote Link to comment https://forums.phpfreaks.com/topic/199621-help-creating-a-shopping-basket-with-php-mysql-and-html/#findComment-1048721 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.