smidgen11 Posted May 20, 2011 Share Posted May 20, 2011 Hi, I have a sql query at the top that runs and echos the result to the page. Each row in the table has a radio but to select and then a submit button at the bottom of the table which should run the form's action which is another php script. Here is what I have for the table portion: <form name="form1" method="post" action="undoentering.php"> <?php echo "<table>"; echo "<thead>"; echo "<tr>"; echo "<td>Select</td>"; echo "<td>Location</td>"; echo "<td>First Name</td>"; echo "<td>Last Name</td>"; echo "<td>User Name</td>"; echo "<td>Extension</td>"; echo "<td>Mac</td>"; echo "<td>Type</td>"; echo "</tr>"; echo "</thead>"; ?> <?php while($rows=mysql_fetch_array($result)){ ?> <?php echo "<tr>"; ?> <td><input name="Selected" type="radio" id="radio[]" value="<? echo $rows['Mac']; ?>"></td> <?php echo "<td>"; echo $rows['Location']; echo "</td>"; echo "<td>"; echo $rows['FirstName']; echo "</td>"; echo "<td>"; echo $rows['LastName']; echo "</td>"; echo "<td>"; echo $rows['UserName']; echo "</td>"; echo "<td>"; echo $rows['Extension']; echo "</td>"; echo "<td>"; echo $rows['Mac']; echo "</td>"; echo "<td>"; echo $rows['Type']; echo "</td></tr>"; ?> <?php } ?> <td colspan="8" align="center"><input name="delete" type="submit" id="delete" value="Undo"></td> My issue is that nothing POSTs to the next page. When doing it like this the record show empty boxes yet the correct number of empty rows is output: <table> <form name="form1" method="post" action="undoexiting.php"> <thead> <tr> <td>Select</td> <td>Location</td> <td>First Name</td> <td>Last Name</td> <td>User Name</td> <td>Extension</td> <td>Mac</td> <td>Type</td> </tr> </thead> <?php while($rows=mysql_fetch_array($result)){ ?> <tr> <td><input name="Selected" type="radio" id="radio[]" value="<? echo $rows['Mac']; ?>"></td> <td><? echo $rows['Location']; ?></td> <td><? echo $rows['FirstName']; ?></td> <td><? echo $rows['LastName']; ?></td> <td><? echo $rows['UserName']; ?></td> <td><? echo $rows['Extension']; ?></td> <td><? echo $rows['Mac']; ?></td> <td><? echo $rows['Type']; ?></td> </tr> <?php } ?> <tr> <td colspan="8" align="center"><input name="Undo" type="submit" id="undo" value="Undo"></td> </tr> </html> Can anyone lend some knowledge on what I may be doing wrong on the first script. And yes, I did and still am using google. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/ Share on other sites More sharing options...
fugix Posted May 20, 2011 Share Posted May 20, 2011 question? Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/#findComment-1218127 Share on other sites More sharing options...
wildteen88 Posted May 20, 2011 Share Posted May 20, 2011 What are you trying to do? Can you post a more descriptive explanation. Also when posting code wrap it within tags. Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/#findComment-1218128 Share on other sites More sharing options...
smidgen11 Posted May 20, 2011 Author Share Posted May 20, 2011 Hopefully this will make sense. So a number of records are queried and output into the table: <?php echo "<td>"; echo $rows['Location']; echo "</td>"; echo "<td>"; echo $rows['FirstName']; echo "</td>"; echo "<td>"; echo $rows['LastName']; echo "</td>"; echo "<td>"; echo $rows['UserName']; echo "</td>"; echo "<td>"; echo $rows['Extension']; echo "</td>"; echo "<td>"; echo $rows['Mac']; echo "</td>"; echo "<td>"; echo $rows['Type']; echo "</td></tr>"; ?> From this table, each record has a radio button next to hit. When the radio button selects a row the Undo (submit button) is clicked and the "Mac" field of the selected record should post so that my next php file (undoentering.php) will be able to echo the value. Undoentering.php: $del_id = ( $_POST['Selected'] ); echo $del_id; Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/#findComment-1218136 Share on other sites More sharing options...
smidgen11 Posted May 20, 2011 Author Share Posted May 20, 2011 just to add a more descriptive answer to what my issue is. When I try to echo $del_id on undoentering.php I get: <? echo $rows['Mac']; ?> Which is the text written in my radio button's value. Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/#findComment-1218144 Share on other sites More sharing options...
smidgen11 Posted May 20, 2011 Author Share Posted May 20, 2011 finally...SOLVED. all i had to do was add "php" to this line. BEFORE <td><input name="Selected" type="radio" id="radio[]" value="<? echo $rows['Mac']; ?>"></td> AFTER <td><input name="Selected" type="radio" id="radio[]" value="<?php echo $rows['Mac']; ?>"></td> thanks guys Quote Link to comment https://forums.phpfreaks.com/topic/236987-php-table-post/#findComment-1218156 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.