mikebyrne Posted February 29, 2008 Share Posted February 29, 2008 I'm trying to get my select variables to pass from my list.php to my edit.php but I just have empty fields at present The code for list.php is <!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=iso-8859-1" /> <title>e-commerce admin page sample | item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black">order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black_on">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div id="dotted"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div id="menu2"> <div id="menu_hide"><!-- --></div> <div id="menu_text_off"> </div> <div id="menu_space1"><!-- --></div> <div class="clr"><!-- --></div> <!-- --> </div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black_on">Games</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/dvdlist.php" class="black">DVD</a></div> <div id="menu_space2"> <!-- --> </div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/cdlist.php" class="black">CD</a></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> <!-- Double Space undernath CD --> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="clr"><!-- --></div> <div class="padTop5"><!-- --></div> <div class="clr"><!-- --></div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- top finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data top finish --> <!-- data content start --> <div id="containerBg4"> <!-- data start --> <form method="post" action="edit.php"> <table width="800" align="center" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td><a href="#">SELECT</a></td> <td><a href="#">PRODCT NO</a></td> <td><a href="#">PRODUCT NAME</a></td> <td><a href="#">STOCK LEVEL</a></td> <td><a href="#">DISPLAY</a></td> <td><a href="#">PRICE</a></td> </tr> <?php // let's get some data include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,Stockamount,Display,Price FROM Product WHERE Producttype = 'Game' "; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)){ // loop through and display ?> <tr align="left"> <td><input type="radio" value="<?php echo $row['ProductNo']; ?>" name="something" /></td> <td><a class="black"><?php echo $row['ProductNo'];?></a></td> <td><?php echo $row['ProductName'];?></td> <td><?php echo $row['Stockamount'];?></td> <td><?php echo $row['Display'] ;?></td> <td><?php echo $row['Price'];?></td> </tr> <tr><td colspan="6"><hr /></td><td></tr> <?php } ?> <tr><td><input type="submit" name="submit" value="Edit" /></td></tr> </table> </div> <div class="clr"><!-- --></div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <!-- data btm finish --> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="padTop16"><!-- --></div> <div class="clr"><!-- --></div> <!-- btm finish --> </div> </div> </body> </html> The code for edit.php is <!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=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <form> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../order/new.php" class="black">order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../sales/sales.php" class="black">sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_on"><a href="../item/list.php" class="black_on">item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">shipping fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../coupon/current.php" class="black">coupon</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../news/list.php" class="black">news</a></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">item / edit</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="titleBox"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="33"> </td> <td width="290" align="left">image</td> <td width="527">detail</td> </tr> </table> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data title finish --> <!-- 1px space start --> <div id="containerBg1"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- 1px space finish --> <!-- data top start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data top finish --> <!-- data content start --> <?php // let's get some data $name = $_POST["something"]; include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,Stockamount,Display,Description,Price FROM Product WHERE ProductNo='$name' "; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)){ // loop through and display ?> <?php } ?> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">picture1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic1.gif" alt="pic1" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">picture2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic2.gif" alt="pic2" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product No:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="0" value="<?php echo $row['ProductNo'];?>" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input name="0" type="text" class="itemEditForm02" v<?php echo $row['ProductName'];?> /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="0" value="<?php echo $row['Description'];?>" /> </textarea> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Remarks:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="0" value="" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">$</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="0" value="<?php echo $row['Price'];?>" /> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Sale:</div> <div class="editRightForm"> <div class="editRadioLink1"> <input name="link" type="radio" value="yes" /> </div> <div class="editRadioLink2">Yes</div> <div class="editRadioLink3"> <input name="link" type="radio" value="no" checked="checked" /> </div> <div class="editRadioLink4">No - sale price: $ </div> <div class="editRadioLink5"> <input type="text" class="newsEditForm02" name="0" value="380" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <div id="btnL"><img src="../images/btn_update.gif" width="73" height="23" /></div> <div id="btnSpace"> <!-- --> </div> <div id="btnR"><img src="../images/btn_clear.gif" width="73" height="23" /></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btm finish --> </div> </body> </html> The variables im get get to show are <input type="text" class="itemEditForm02" name="0" value="<?php echo $row['ProductNo'];?>" /> etc in edit.php Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 The variables im trying to show are in edit.php <input type="text" class="itemEditForm02" name="0" value="<?php echo $row['ProductNo'];?>" /> Is this the correct way to phrase the code??? Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 1, 2008 Share Posted March 1, 2008 yes, but don't give variables names that begin with (or only use) numbers. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 So what would you recommend to get it to work? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 What I'm trying to do is get the user to select the item in list.php. The productNo is then stored and used in edit.php to bring up the corresponding product details ie Price, Decription etc Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 1, 2008 Share Posted March 1, 2008 $name = $_POST["something"]; include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,Stockamount,Display,Description,Price FROM Product WHERE ProductNo='$name' "; Since that's what's in edit.php, the 'name' of your input box should be something. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 if changed it to <input type="text" class="itemEditForm02" name="something" value="<?php echo $row['ProductNo'];?>" /> but still not displaying any output Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 1, 2008 Share Posted March 1, 2008 You haven't actually got anything in your loop. You need to put your echo $row['ProductNo'] inside your loop i.e. before the closing } Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 1, 2008 Share Posted March 1, 2008 Your html seems a bit overly complicated as well so it is hard to imagine how it is supposed to be. You have a lot of pointless divs and empty comments. Maybe you could cut down the unused html and still get the same result. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 So would I need to place the whole layout of the form within the loop? The following just give me an error Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\Admin_files\edit.php on line 212 <?php // let's get some data $name = $_POST["something"]; include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,Stockamount,Display,Description,Price FROM Product WHERE ProductNo='$name' "; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)){ // loop through and display ?> <?php } <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">picture1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic1.gif" alt="pic1" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">picture2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic2.gif" alt="pic2" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product No:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="something" value="<?php echo $row['ProductNo'];?>" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input name="0" type="text" class="itemEditForm02" v<?php echo $row['ProductName'];?> /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="0" value="<?php echo $row['Description'];?>" /> </textarea> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Remarks:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="0" value="" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">$</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="0" value="<?php echo $row['Price'];?>" /> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Sale:</div> <div class="editRightForm"> <div class="editRadioLink1"> <input name="link" type="radio" value="yes" /> </div> <div class="editRadioLink2">Yes</div> <div class="editRadioLink3"> <input name="link" type="radio" value="no" checked="checked" /> </div> <div class="editRadioLink4">No - sale price: $ </div> <div class="editRadioLink5"> <input type="text" class="newsEditForm02" name="0" value="380" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <div id="btnL"><img src="../images/btn_update.gif" width="73" height="23" /></div> <div id="btnSpace"> <!-- --> </div> <div id="btnR"><img src="../images/btn_clear.gif" width="73" height="23" /></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> ?> </form> Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 1, 2008 Share Posted March 1, 2008 Not sure exactly what parts you want in your loop but this is my guess. <?php // let's get some data $name = $_POST["something"]; include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,Stockamount,Display,Description,Price FROM Product WHERE ProductNo='$name' "; $result = mysql_query($query) or die (mysql_error()); while ($row = mysql_fetch_array($result)){ // loop through and display ?> <div id="containerBg4"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop1"> <!-- data Left start --> <div class="editLeft"> <!-- picture1 start --> <div class="editLeftBox">picture1:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic1.gif" alt="pic1" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture1 finish --> <div class="padTop50"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- picture2 start --> <div class="editLeftBox">picture2:</div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"><img src="../../images/pic2.gif" alt="pic2" width="245" height="245" /></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="editLeftBox"> <input type="file" name="uploadfile" class="newsUpFile"> </div> <div class="clr"> <!-- --> </div> <!-- picture2 finish --> </div> <!-- data Left finish --> <!-- data Right start --> <div class="editRight"> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product No:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="something" value="<?php echo $row['ProductNo'];?>" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Product Name:</div> <div class="editRightForm"> <input name="0" type="text" class="itemEditForm02" v<?php echo $row['ProductName'];?> /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Description:</div> <div class="editRightForm"> <textarea type="text" class="itemEditForm03" name="0" value="<?php echo $row['Description'];?>" /> </textarea> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Remarks:</div> <div class="editRightForm"> <input type="text" class="itemEditForm02" name="0" value="" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Price:</div> <div class="editRightForm"> <div class="editItemPrice1">$</div> <div class="editItemPrice2"> <input type="text" class="itemEditForm04" name="0" value="<?php echo $row['Price'];?>" /> </div> <div class="clr"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Sale:</div> <div class="editRightForm"> <div class="editRadioLink1"> <input name="link" type="radio" value="yes" /> </div> <div class="editRadioLink2">Yes</div> <div class="editRadioLink3"> <input name="link" type="radio" value="no" checked="checked" /> </div> <div class="editRadioLink4">No - sale price: $ </div> <div class="editRadioLink5"> <input type="text" class="newsEditForm02" name="0" value="380" /> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop3"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- dat start --> <div class="editRightBox"> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> </div> <div class="editRadio4">hide</div> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <div class="padTop75"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <!-- data Right finish --> </div> <div class="clr"> <!-- --> </div> <div class="padTop11"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dottedIn"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- data finish --> <!-- btn start --> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="btn"> <div id="btnL"><img src="../images/btn_update.gif" width="73" height="23" /></div> <div id="btnSpace"> <!-- --> </div> <div id="btnR"><img src="../images/btn_clear.gif" width="73" height="23" /></div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop16"> <!-- --> </div> <div class="clr"> <!-- --> </div> <!-- btn finish --> </div> <div class="clr"> <!-- --> </div> <?php } ?> <!-- data content finish --> <!-- data btm start --> <div id="containerBg3"> <div class="padTop1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- data btm finish --> </form> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 ProductNo and Price works!!! But for some reason the ProductName and Description doesn't???? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 For some reason I cant get the description to pass, I presume its something to do with /textarea? The code I have is: <textarea type="text" class="itemEditForm03" name="something" value="<?php echo $row['Description'];?>"/> </textarea> Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 1, 2008 Share Posted March 1, 2008 Do make certain that each of the form inputs you want to pass from oneplace to another have different names. Don't use numbers as variable names ... ... and since the data you display in the form comes from the same record, all you actually need to pass to edit.php is the record number. Then edit.php can retrieve the record, populate your edit boxes, etc. Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 Thats what I thought I was doing! Just cant get the description to come up Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 1, 2008 Share Posted March 1, 2008 Textareas are slightly different to text inputs. Do it like this: <textarea type="text" class="itemEditForm03" name="something" ><?php echo $row['Description'];?></textarea> Quote Link to comment Share on other sites More sharing options...
deansatch Posted March 1, 2008 Share Posted March 1, 2008 And as Andy was explaining, make sure your fields are named differently. Use relevant names so it makes your code easier to understand when you go back to work on it at a later date. e.g. <textarea type="text" class="itemEditForm03" name="description" ><?php echo $row['Description'];?></textarea> <input type="text" class="itemEditForm04" name="price" value="<?php echo $row['Price'];?>" /> <input name="productname" type="text" class="itemEditForm02" value="<?php echo $row['ProductName'];?>" /> etc... Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 1, 2008 Author Share Posted March 1, 2008 0Yeah will do, In the process of doing that now. Just trying to figure out now how to store pictures into Navicat (MySQL GUI Frontend) 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.