deansaddigh Posted November 19, 2009 Share Posted November 19, 2009 Basically passing a variable to another page <?php echo '<td><a href=product_details.php?productid='.$_POST[$productid].'>' .$productname;?> Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted November 19, 2009 Share Posted November 19, 2009 <?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?> Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 19, 2009 Share Posted November 19, 2009 why your searching the product id in the post should it just be <?php echo '<td><a href="product_details.php?productid='.$productid.'">' .$productname;?> Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted November 19, 2009 Author Share Posted November 19, 2009 Thank you kind sir Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted November 19, 2009 Author Share Posted November 19, 2009 why your searching the product id in the post should it just be <?php echo '<td><a href="product_details.php?productid='.$productid.'">' .$productname;?> Im basically trying to pass through the product id to another page so i can use it? is this right Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 19, 2009 Share Posted November 19, 2009 the code I posted will be correct, then in your other page you can access it through $_GET['productid'] Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted November 19, 2009 Author Share Posted November 19, 2009 Thanks very much for your help now i am getting this error Notice: Undefined index: 21 in C:\wamp\www\Php Shoping cart\index.php on line 104 that line is the code you gave me, im assuming i have done soemthing wrong somewhere else within the code so is it possible to just take alook at the code <!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> <?php include 'includes/connection.php'; ?> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="images/animated_favicon1.gif" /> <link rel="stylesheet" type="text/css" href="css/layout.css" /> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <script type="text/javascript" src="js/mojozoom.js"></script> <link type="text/css" href="css/mojozoom.css" rel="stylesheet" /> <title>Nextdayfrags.co.uk</title> </head> <body> <!--wrapper to hold site--> <div id="wrapper"> <!--Logo holder--> <div id="header"></div> <div id="left"> <div class="nav"> <ul> <li><a href="#">SPS frags</a></li> <li><a href="#">LPS frags</a></li> <li><a href="#">Soft Coral frags</a></li> <li><a href="#">Coral Frag packs</a></li> <li><a href="#">SPS Coral Colonies</a></li> <li><a href="#">LPS Coral Colonies</a></li> <li><a href="#">Anemones</a></li> <li><a href="#">Clean Up Critters/ Inverts</a></li> <li><a href="#">Coral Food</a></li> <li><a href="#">Reef Accesories</a></li> <li><a href="#">Gift Vouchers</a></li> </ul> <div align="center"> <!-- Step 2: add the custom 'data-zoomsrc' attribute to your image to specify the source of the large image --> <img src="images/paypal.png" data-zoomsrc="images/paypalbig.png" id="myimage" /> </div> </div> </div> <div id="right"> <p>Welcome to Nextdayfrags.com We offer a variety corals, critters and select dry goods through our online store. Whether you're searching for healhty, colourful SPS coral frags or wanting to add some movement that LPS corals provide, here at mailordercorals, we have you covered. With new shipments arriving all the time, we highly recommend you subscribe to our newsletter, that way you can stay updated - and we may just have some exclusive offers for our mailing list members. Here at mailordercorals, we aim to offer the very best in customer service and all our livestock comes with our live arrival guarantee, so whether you are a complete novice starting out or an old seasoned reefkeeper, we know you will find something that interests you from our ever growing online catalogue. Don't forget you can also order over the phone (Sales Hotline: 01383 428590) or come visit our Coral house (by appointment only). What are you waiting for? Check out the latest additions to our online catalogue below: </p> <?php $query = "select product.ProductID, product.ProductName, product.ProductCategory, product.ProductPrice, product.ProductQuantity, product.ProductDescription, image.ImageID, image.ImagePath, image.ImageName, product_image.ImageID, product_image.ProductID FROM product JOIN product_image ON product.ProductID = product_image.ProductID JOIN image ON image.ImageID = product_image.ImageID"; //Use this query below $result = mysql_query($query, $conn) or die ("Unable to perform query"); echo '<table border ="2">'; echo '<tr>'; echo '<th> Product Name </th>'; echo '<th> Product Category</th>'; echo '<th> Product Price</th>'; echo '<th> Product Description</th>'; echo '<th> Image </th>'; echo '</tr>'; while($row= mysql_fetch_array($result)) { //Get the course id so that can compare the id with the id of the unique to find the relevant section.. $productname = $row['ProductName']; $productcategory = $row['ProductCategory']; $productprice = $row['ProductPrice']; $productdescription = $row['ProductDescription']; $imagename = $row["ImageName"]; $imagepath = $row["ImagePath"]; //Get the product id so i can pass it $productid =$row["ProductID"]; $file = $imagepath.$imagename; ?> <tr> <!-- Make the product name clickable and pass through its id --> <?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?> <td><?php echo $row['ProductCategory'];?></td> <td><?php echo $row['ProductPrice'];?></td> <td><?php echo $row['ProductDescription'];?></td> <?php echo '<td><a href="'.$file.'" target="_blank" rel="lightbox"><img src="'.$file.'" width="100" height="100"/></td>';?> </tr> <?php } ?> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 19, 2009 Share Posted November 19, 2009 this <?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?> should be <?php echo '<td><a href="product_details.php?productid='.$productid.'">' .$productname.'</a>';?> Quote Link to comment Share on other sites More sharing options...
deansaddigh Posted November 19, 2009 Author Share Posted November 19, 2009 Thanks sooo much been playing around for hours to sort that out. I get so confused with all the '' and "" ect Thanks again for your kind help Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 19, 2009 Share Posted November 19, 2009 Your welcome if you consider this topic solved please click the Topic Solved at the bottom right Quote Link to comment 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.