0

is it possible to input a data grid in php like in VB6?
because in my program, user will display lots of data and displaying it in a data grid (clickable) is the best way, we all know that in VB6, once the user clicked anywhere in the grid, it is possible to get the data of the selected row/column..


please help..^_^

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by CJesusSaves
0

If the out put data comes from a database, then one can store the row IDs in html anchor tags. Then when the user clicks, sends the stored ID back to sql query for all other data retrieval.

After using sql queries to get the data, you can output in table/grid form.
http://www.w3schools.com/php/php_mysql_select.asp

<table >
      <tr> 
            <th>Something</th>
            <th>Something Else</th>
      </tr> 

<?php
do { ?>
  <tr> 
        <td><a href="myPage.php?id=<? echo $row_stuff['id'];?>"><? echo $row_stuff['stuff']; ?></a></td>
        <td><? echo $row_stuff['more_stuff']; ?></td>
 </tr> 
<?php }while ($row_stuff = mysql_fetch_assoc($stuff));
?>
</table>

You will then need to use PHP $_GET to get the value of the id stored in the url, look here:
http://www.w3schools.com/php/php_get.asp
Then again use some sql queries to again retrieve the data and output more of that row data or whatever...

$id = $_GET['id'];
$stuff = mysql_query("SELECT * FROM stuff
WHERE id='$id'");

Otherwise, if not from a database, then it depends on the implementation of the data, each row should have a unique identifier, that way when clicked, the identifier can be used to retrieve data specific to itself.

Is this what you are asking?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.