mikebyrne Posted January 23, 2008 Share Posted January 23, 2008 Hi I can get my records to display but Id like a checkbox to appear with every record. Can I incorporate this into my loop or will i have to display the results in a set table format and place the checkbox within this?? My code is: <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61"><?php echo $row['Orderdate'];?></td> <td width="61"><?php echo $row['Dispatchdate'];?></td> <td width="230"><?php echo $row['Custname'];?></td> <td width="170"><?php echo $row['Trackno'];?></td> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136">test</td> </tr> <? } ?> </table> Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/ Share on other sites More sharing options...
adam291086 Posted January 23, 2008 Share Posted January 23, 2008 <?php // let's get some data include('adminconnect.php'); $sql = mysql_query("SELECT OrderNo, Orderdate, Custname, Amount, Shippingmet FROM admin WHERE Orderdate = DATE_FORMAT(now(),'%y/%m/%d')"); while( $row = mysql_fetch_array($sql) ) { // loop through and display ?> <tr align="left"> <td width="33"> </td> <td width="82"><a href="javascript:openWindow('popup_detail.html', 'NewWindow', 615, 600)" class="black"><?php echo $row['OrderNo'];?></a></td> <td width="61"><?php echo $row['Orderdate'];?></td> <td width="61"><?php echo $row['Dispatchdate'];?></td> <td width="230"><?php echo $row['Custname'];?></td> <td width="170"><?php echo $row['Trackno'];?></td> <input type = "checkbox name="checkbox"> <td width="56" align="right"><?php echo $row['Amount'];?></td> <td width="21"> </td> <td width="136">test</td> </tr> <? } ?> </table> Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/#findComment-446915 Share on other sites More sharing options...
mikebyrne Posted January 23, 2008 Author Share Posted January 23, 2008 Maybe ive requested the wrong thing? Isn't a checkbox a little box that displays a tick when you select it. The code above seems to provide me with an input box Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/#findComment-446920 Share on other sites More sharing options...
mikebyrne Posted January 23, 2008 Author Share Posted January 23, 2008 Fixed it with <input type = "checkbox" name="checkbox"> But the checkbox displays above the valuse as opposed to on the same line Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/#findComment-446928 Share on other sites More sharing options...
beansandsausages Posted January 23, 2008 Share Posted January 23, 2008 what line of code you want the check box to be next? <td width="61"><?php echo $row['Orderdate'];?></td> here? <td width="61"><?php echo $row['Dispatchdate'];?></td> here? <td width="230"><?php echo $row['Custname'];?></td> here? <td width="170"><?php echo $row['Trackno'];?></td> here? <input type = "checkbox name="checkbox"> Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/#findComment-446930 Share on other sites More sharing options...
mikebyrne Posted January 23, 2008 Author Share Posted January 23, 2008 It was just a spacing issue with the html Thanks for all the help Link to comment https://forums.phpfreaks.com/topic/87372-solved-checkbox-with-displayed-with-every-record-in-loop/#findComment-447009 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.