html,php,sql form with table -
I have html form with PHP; MySQL queries that select data from a database and display it in a table, I am now struggling to split that table into pages if its too long, and the first row of the table is clickable And to sort that header is pressed. I managed to do this, but with a classic table, not one that is inside the form and submit the button. Here's a part of my code.
& lt; Form id = "form6" name = "form6" method = "post" action = "user.php" & gt; & Lt; P class = 'p1' id = 'pall' & gt; Display of all data & lt; / P & gt; & Lt; Div class = 'div1' & gt; & Lt; Input type = "submit" name = "display_all_data" id = "display_all_data" value = "display all data" /> & Lt; / Div & gt; If (isset ($ _ POST ['display_all_data'])) {echo "& lt; script> window.location.href = '# pAll'; "; Echo "& lt; table align = 'center' class = 'table2' & gt; & lt; tr & gt; TD width = '5%' & gt; & lt; a href = '? Page = orderID '& Gt; ID & lt; / a & gt; & lt; / td & gt; // something that I want, but it only works with the classic table which loads on page load, press the button Not After & lt; td width = '25% '> NAME & lt; / td> & lt; / TR & gt; "; SQL stuff .... and display rows {echo "<"> <;;;;;;;;; Echo "& lt; td width = '5%' & gt;" . $ Line ['id'] "& lt; / td & gt;"; Echo "& lt; td width = '25% '& gt;" . $ Line ['NAME'] "& lt; / td & gt;"; Echo "& lt; / tr & gt;"; } Resonates "& lt; / table & gt;"; Echo "& lt; / div & gt;"; }? & Gt; & Lt; / Form & gt;
So I need this table so that there is an option to display more pages, and the option to sort by the selected column, for example ID
and When I press the ID column to sort ID by ASC, but I can not do this because I have a table which is only shown when the submit button is pressed if the TD column is not pressed.
I hope that you will understand my question, feel free to ask more information if you can help.
Thanks in advance.
Your question is a bit rumored
- If you are on the client side Table sorting requires that you should use the library or similar (pure jquery or javascript implementation itself)
- If you want to add paging in the case of a large amount of date you can record it in your server Should be implemented from the part of the selection, check an example here Switch to:
Comments
Post a Comment