Jump to content

PHP/postreQL and Hyperlinks


DCM

Recommended Posts

Hello all,

 

I currently have some php code which upon a user clicking a search button connects to a back end posgresql database and outputs the users search results in the form of:

 

Hostname      IP Address        Operating System

--------------------------------------------------------------

HOSTA            1.1.1.1              Windows

HOSTB            2.2.2.2                Linux

 

With this i have no problem and it works fine. What i would like to do though is as i have each hostname outputted as a hyperlink, i want to be able  to then allow the user upon clicking the hyper link of any given hostname to be presented with a more detailed overview of the information associated with that host, i.e. the page reloads upon the user clicking the hyper link but instead of the previous search results the user is now presented with another HTML form populated by all the information stored in the database specific to that host.

 

I am just a bit confused as to how to track the hostname ect from a user clicking the hyperlink, I realise it is likely to be passed via a session variable but how do i set that from a click event of the hyperlink?

 

Thanks for taking the time to read this, any advice is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/214440-phppostreql-and-hyperlinks/
Share on other sites

echo "<a href = 'searchpage.php?id=$some_var'> ".$hostname."</a>"; 

 

$some_var is whatever variable currently holds the unique identifying value you want to use as you are looping through the records from the query.

 

In the searchpage.php code, $_GET['id'] will give you identifying value for whichever link was clicked.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.