Jump to content

[SOLVED] Passing a variable through a hyperlink...


Derleek

Recommended Posts

So I am creating a page that displays titles of messages that are stored in a DB.  I would like to make each title a hyperlink to each message.  Is there a way to send the title of a given article to a page called 'msgHandler.php' when a message title is clicked?

 

I was thinking of using some kind of onClick command, but i'm not proficient in JavaScript.  So is there any way to send a variable through a hyperlink so i don't have to create an individual file for each message that is submitted to the DB?

So I am creating a page that displays titles of messages that are stored in a DB.  I would like to make each title a hyperlink to each message.  Is there a way to send the title of a given article to a page called 'msgHandler.php' when a message title is clicked?

 

I was thinking of using some kind of onClick command, but i'm not proficient in JavaScript.  So is there any way to send a variable through a hyperlink so i don't have to create an individual file for each message that is submitted to the DB?

While looping through your result:

<?php 
  $var='titleofarticle';
  echo "<a href=\"msgHandler.php?var=$var\">Title of message</a>';
?>

and to retrieve it:

<?php 
$var=$_GET['var'];
?>

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.