I am new to PHP and working on a PHP - MYSQL project. The problem I am facing is described below, kindly guide me about it.
I have a table with two columns "Name" and "Type". I take input from user using a text box and return all the values matching "Name" column of the table.
The results are shown in an html table in which each row holds two values i.e. "Name" and "Type" returned from table using MYSQL query.
Now i want a way in which text showed in first column i.e. "Name" becomes a hyperlink and on clicking it takes to a new page displaying "Name" & "Type" which was clicked.
Thanks
Table columns as hyperlink
Moderator: General Moderators
Re: Table columns as hyperlink
Perhaps the easiest way to do this is to create a page to display individual records and pass the desired name via GET (ie. somepage.php?name=$name).
Re: Table columns as hyperlink
Assuming the target is details.php:
Code: Select all
$query = "
SELECT concat('<a href=details.php?name=',name,'&type=',type,'>',name,'</a>') as link
FROM table
";