euel Posted December 3, 2011 Share Posted December 3, 2011 Gud morning ppl! I nid some enlightenment, so i have a code like this, (i removed the exact variable name and stuff to make it simple..) function some_function() { echo "<table>"; echo "<th>"; $variable_set = select_all_variable(); // function to call data while($variable = mysql_fetch_array($variable_set)) { echo "<form action='link.php' method='post'>"; echo "<input type='hidden' name='name' value='{$variable['id']}'>"; echo "<input type='hidden' name='name' value='{$session_id}'>"; echo "<tr>" echo "<td>" . $variable['name'] . "</td>"; echo "<td>" . $variable['location'] . "</td>"; echo "<td>"; echo "<input type='submit' name='submit' value='Submit' />"; echo"</td>"; echo "</tr>"; echo "</form>"; } echo "</table>"; } my setup is to display the all data from the database in a table and make a submit button on each row to able to relay the id's to an another page.. my question is.. this gonna work ? cuz when i click the submit button it doesn't send/post the data i need specifically both the hidden input type.. which will be displayed on the link.php page.. any thoughts? thanks nub here.. Quote Link to comment https://forums.phpfreaks.com/topic/252361-form-in-a-table/ Share on other sites More sharing options...
phpfreak Posted December 3, 2011 Share Posted December 3, 2011 Move the <form> above the <table> and the </form> below the </table> Quote Link to comment https://forums.phpfreaks.com/topic/252361-form-in-a-table/#findComment-1293775 Share on other sites More sharing options...
euel Posted December 3, 2011 Author Share Posted December 3, 2011 thanks for the reply! wouldn't that make a single submit button for the whole table? but i need to make a submit button on each row..cuz every row has a different $variable_id. Quote Link to comment https://forums.phpfreaks.com/topic/252361-form-in-a-table/#findComment-1293788 Share on other sites More sharing options...
euel Posted December 3, 2011 Author Share Posted December 3, 2011 i cant seem to make it work like this..so decided to remove the form and change the submit button to a <a> like this echo "<a href=\"link.php?event_id=" . urlencode($variable['id']) . "&user_id=" . urlencode($session_id) . "\">"; then throw and catch it the link.php... the only problem here is that user can see from the address bar the id's which is not a good thing cuz they might change it.. :'( im gonna test it if will work fine on the insertion process then if it working well, I'll mark this thread as solved. thoughts and ideas are still welcome though! Quote Link to comment https://forums.phpfreaks.com/topic/252361-form-in-a-table/#findComment-1293790 Share on other sites More sharing options...
euel Posted December 3, 2011 Author Share Posted December 3, 2011 i found out that you can encode the data using base64_encode so.. i replaced urlencode with base64_encode to make the data a little secure.. then decode it in the link.php form which works well. Still finishing everything to check if all works perfect.. Quote Link to comment https://forums.phpfreaks.com/topic/252361-form-in-a-table/#findComment-1293795 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.