Jump to content

Hyperlinks and carrying a variable over


soullessj

Recommended Posts

What i need to do is in the hyperlink add a variable to be carried over ie. id = 2.

if im not mistaken i can just add a name tag and put id = 2 for it.

and then use that as the id variable in the next page.

 

then i need to tell the next page to use that variable so that i can use it in a sql query command to display data from the table where the id is 2 and show the relative information.

 

just need the hyperlink and how to include what that id variable will be so that i can query for just that information.

 

Thanks

Link to comment
Share on other sites

What you are doing is attempting to pass a GET parameter through the url. This is done using the following syntax:

 

<?php
$id = '1224';
<a href="http://www.somesite.com/somepage.php?id=$id"></a>
// you can append as many variables as you need. These have to be seperated by the & sign.
<a href="http://www.somesite.com/somepage.php?id=$id&id2=$id2.........."></a>

then on the page you are sending the variables to:

$id = $_GET['id];

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.