php / sql tables

0 sahar far · September 8, 2014
I have an html table that uses php to read from my database on phpmyadmin.

each row of the table has a button next to it. BUT this button is generated automatically it is not hard coded. i want it so that once the user selects a button that row which belongs to the button they clicked on to be displayed on the next page (the information from the columns) 

At the moment it is displaying the last row of every table regardless of which button the user selects. 

What should i do inorder to display the row of the table for which the user selected the button for? 

col1col2col3col4col5col6 (select)
xxxxxselect button 1
yyyyyselect button 2

for example the user selects the "select button 1" on the first row. on the next page they should see all the data 'x' NOT y.
but my code always displays the data for the last row. 'select button 2' data y.

how do i fix this so that the selected row i.e once select button 1 is selected all data for that row 'x' is presented on the next page. 


Post a Reply


Oldest  Newest  Rating
0 Jasmin Bakalović · September 9, 2014
For that you need to use $_GET method.

Imagine, your file is next_page.php for getting informations from database but to display informations from selected button.

Your link for that button will be like next_page.php?show=x

In file next_page you will have variable like $data = $_GET['show'] and now, show will containt x ($data = "x")

And, only thing what you need to do now is to say to query to select data where `some_field` = {'$data'}

If you didn't understand this, say, and I will write simple code to be more clear.
0 sahar far · September 15, 2014

thanks for your reply :) 
im not sure how to use the get method. if possible, could you please send an example code? 

thanks heaps
0 Jasmin Bakalović · September 15, 2014
config.php      =>
index.php       =>
profile.php      =>

Try to figure out with this and look again to my first post here.
  • 1



Server-side, HTML embedded scripting language used to create dynamic Web pages.