mikebyrne Posted February 27, 2008 Share Posted February 27, 2008 I want to have a radio button appear at the start of each line of my loop aswell as an edit button at the end. My code at the minute is: <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,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 width="33"> </td> <td width="82"><a class="black"><?php echo $row['ProductNo'];?></a></td> <td width="61"><?php echo $row['ProductName'];?></td> <td width="61"><?php echo $row['Display'] ;?></td> <td width="230"><?php echo $row['Price'];?></td> </tr> <? } ?> </table> What i want to happen is that when the radio button is activted and the "Edit" button is pressed the page will be redirect to my edit.php page and the varibles will also be passed over Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 27, 2008 Share Posted February 27, 2008 <form method="post" action="edit.php"> <table width="850" border="0" cellspacing="0" cellpadding="0"> <?php // let's get some data include('adminconnect.php'); $query = "SELECT ProductNo,ProductName,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 width="33"><input type="radio" value="<?php echo $row['ProductNo'];?>" name="something" /></td> <td width="82"><a class="black"><?php echo $row['ProductNo'];?></a></td> <td width="61"><?php echo $row['ProductName'];?></td> <td width="61"><?php echo $row['Display'] ;?></td> <td width="230"><?php echo $row['Price'];?></td> <td width="230"><input type="submit" name="submit" value="Edit" /></td> </tr> <? } ?> </table> </form> I would personally just use a simple link e.g. <a href="edit.php?id=$id>Edit</a> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted February 27, 2008 Author Share Posted February 27, 2008 Yeah that seems to work great. THANKS!! I know its not a php issue but my figures aren't lined up with my headings. The headings are formatted as below: <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="25"> </td> <td width="45" align="center">ftd</td> <td width="100"><a href="#">serial no.</a></td> <td width="333"><a href="#">product name</a></td> <td width="95" align="center">display order</td> <td width="46" align="center"><a href="#">display</a></td> <td width="66" align="right"><a href="#">pricet</a></td> <td width="30"> </td> <td width="110">action</td> The results are formattted as below <tr align="left"> <td width="33"><input type="radio" value="<?php echo $row['ProductNo'];?>" name="something" /></td> <td width="82"><a class="black"><?php echo $row['ProductNo'];?></a></td> <td width="61"><?php echo $row['ProductName'];?></td> <td width="61"><?php echo $row['Display'] ;?></td> <td width="230"><?php echo $row['Price'];?></td> <td width="230"><input type="submit" name="submit" value="Edit" /></td> </tr> <? } ?> </table> Any help would be great!!! Quote Link to comment Share on other sites More sharing options...
deansatch Posted February 27, 2008 Share Posted February 27, 2008 <table width="850" border="0" cellspacing="0" cellpadding="0"> <tr align="left"> <td width="25"> </td> <td width="100"><a href="#">serial no.</a></td> <td width="333"><a href="#">product name</a></td> <td width="95">display order</td> <td width="46"><a href="#">display</a></td> <td width="66"><a href="#">pricet</a></td> <td width="30"> </td> <td width="110">action</td> </tr> <tr align="left"> <td><input type="radio" value="ProductNo<?php echo $row['ProductNo']; ?>" name="something" /></td> <td><a class="black"><?php echo $row['ProductNo'];?></a></td> <td><?php echo $row['ProductName'];?></td> <td>Display order results</td> <td><?php echo $row['Display'] ;?></td> <td><?php echo $row['Price'];?></td> <td> </td> <td><input type="submit" name="submit" value="Edit" /></td> </tr> <? } ?> </table> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted February 27, 2008 Author Share Posted February 27, 2008 Thats a little better but still no right serial no. product name display order display pricet action 1 Call of Duty 4: Modern Warfare Display order results yes 55.99 2 Assassin's Creed Display order results yes 55.99 5 Ace Combat 6: Fires Of Liberat Display order results yes 55.99 3 The Simpsons Game Display order results yes 57.99 4 Need For Speed: ProStreet Display order results yes 55.99 Product name is too far to the left and display and pricet are too far to the left 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.