ali_2kool2002 Posted February 12, 2007 Share Posted February 12, 2007 Hi im using a while loop to go through my query from the database. I get a product id and store it to the variable using this line $productId = $results['productId']; I then try printing it on screen the value and comes up with 1, 2, 3, 4, which is correct but when i just enter it in the hidden input value it just only sends the value 4 which is the last value to the handeling form... If anyone can help or is on msn messenger i could send the files as im new to this im not sure how to send files here so add me plz [email protected] (sorry about the name ,,,lol only msn addy i hv) HOPE SOME1 OUT THERE CAN HELP ME ,,, cheers <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <? //connect to the DB session_start(); require_once('mysql_connect.php'); $display_block = "<h1>PRODUCTS - Product Detail</h1>"; //validate item $get_item = "select c.catId as catId, c.cat_name, p.productId,p.productName, p.price, p.productDescription, p.image from product as p left join category as c on c.catId = p.catId"; $get_item_res = mysql_query($get_item) or die(mysql_error()); if ($get_item_res) { echo '<table align="center" cellspacing="1" cellpadding="5"> <tr><td align="left"><b>Cat Id</b></td> <td align="center"><b> Category Name</b></td> <td align="center"><b> Item Name</b></td> <td align="center"><b> Item Description</b></td> <td align="center"><b> Images</b></td> <td align="center"><b> Price</b></td> </tr></table>'; while ($results = mysql_fetch_array($get_item_res, MYSQL_ASSOC)) { //variable to hold image file name from array extract($results); $image = $results['image'] ; //variable to hold productId from array $productId = $results['productId']; echo $productId; echo '<form method = post action="addtocart.php">'; echo'<INPUT TYPE ="submit" name = "submit" value = "Add to Cart" maxlength "50"> <input type="hidden" name="sel_item_id" value="'.$productId.'">'; } // echo '</table>'; //echo $display_block; } else { // If it did not run OK. echo '<p>The current products could not be retrieved. We apologize for any inconvenience.</p>'; echo '<p>' . mysql_error() . '</p>'; } mysql_close(); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> </body> </html> Link to comment https://forums.phpfreaks.com/topic/38157-need-help-plzz-on-hidden-values/ Share on other sites More sharing options...
.josh Posted February 13, 2007 Share Posted February 13, 2007 WRONG FORUM AND INAPROPRIAET TITL3!!!!111 OMG WTF LOL THREAD CLOS3D!!!1!!1 LOLLOLOLZZZZ!!!?!?!?!!! Link to comment https://forums.phpfreaks.com/topic/38157-need-help-plzz-on-hidden-values/#findComment-183187 Share on other sites More sharing options...
Recommended Posts