Sunday 15 April 2012

php - How: HTML table row click results in POST form linking to subsequent page -


All evening, I have a form that is populated from a SQL database.

  & lt; Table class = "sorted" range = "2" cells = "2" cellpadding = "2" & gt; & Lt; TR & gt; & Lt; Th & gt; Serial Number & lt; / Th & gt; & Lt; Th & gt; Date & lt; / Th & gt; & Lt; Th & gt; Time & lt; / Th & gt; & Lt; Th & gt; Color & lt; / Th & gt; & Lt; Th & gt; Design & lt; / Th & gt; & Lt; Th & gt; Results & lt; / Th & gt; & Lt; / TR & gt; & Lt ;? Php $ i = 0; While ($ i & lt; $ num) {$ serial = mysql_result ($ result, $ i, 'serial_number'); $ Date = mysql_result ($ result, $ i, 'date'); $ Time = mysql_result ($ result, $ i, 'time'); $ Airport = mysql_result ($ result, $ i, 'color'); $ Terminal = mysql_result ($ result, $ i, 'design'); $ Result = mysql_result ($ result, $ i, 'result'); ? & Gt; & Lt; TR & gt; & Lt; TD & gt; & Lt ;? Php echo $ serial; ? & Gt; & Lt; / A & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt ;? Php echo $ date; ? & Gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt ;? Php echo $ time; ? & Gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt ;? Php echo $ color; ? & Gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt ;? Php $ echo design; ? & Gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt ;? Php ek $ results; ? & Gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt ;? Php $ i ++; }? & Gt;   

What I would like to do is clickable on each row of the table when every row is clicked, then the data of that row (first cell) through a cell (POST) Is sent to the next page. Can one form be integrated into each table ??

While creating your table, try with the code in echo:

 < Code> & lt; Td> & Lt ;? Php echo ('& lt; a href = "my_page.php? Verb and serial ='. $ Serial. '" & Gt;'. $ Serial. '& Lt; / a & gt;'); & Gt; & Lt; / TD & gt;   

For every data you have!

Other solutions without action

  & lt; Td> & Lt ;? Php echo ('& lt; a href = "my_page.php? Serial ='. $ Serial. '" & Gt;'. $ Serial. '& Lt; / a & gt;'); & Gt; & Lt; / TD & gt;   

my_page.php - to send data

? [Variable_name] - Where data is stored

No comments:

Post a Comment