Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming a hyperlink 1

Status
Not open for further replies.

overyde

Programmer
Joined
May 27, 2003
Messages
226
Location
ZA
Can I assign a name to hyperlink so as I can use it in a session variable. The page the hyperlinks are on is a standard html page. I need to assign each one a name for use as a session variable. How do I do this?

Reality is built on a foundation of dreams.
 
u cannot get the name of an hyperlink in PHP. never tried it but i dont think it will work. since the links do not change (HTML page) why not save the links themselves in the session (hadrcode them)...

Known is handfull, Unknown is worldfull
 
Using the name property of an <A> tag is for linking to different parts of the same page.
e.g. <a href=#myLocation>Location</A>


and down farther you would have:
<A NAME='myLocation'>DATADATADATA</A>

There is an ID property normally used for styling but ou should be able to adopt it to your own use. I haven't used it so im not sure of its limitations but give it a shot anyway
 
vbkris
I have a huge amount of hyperlinks (restaurants). If I could find some way of assigning a name to them then I wouldn't have to worry about making seperate view pages for them. I'm looking at possibly using hidden fields but I cant have a submit button. this is quite a mindbender!!!


Reality is built on a foundation of dreams.
 
so u say only the content changes huh? why dont u do this instead:
let all the links point to one php page:
<a href=&quot;link.php?lnk=Link1&quot;>Link1</a>
<a href=&quot;link.php?lnk=Link2&quot;>Link2</a>

in link.php:
<?
$lnk=$_GET['lnk'];
echo $lnk; //This will give u the link that has been clicked.
?>

hth

Known is handfull, Unknown is worldfull
 
If this opens up in a new page (i.e. <a href=&quot;link.php?lnk=Link1&quot; target=&quot;_blank&quot;>link1</a>

will this value be carried over to the new page or do you need to do a session transfer?

Reality is built on a foundation of dreams.
 
ie if link.php opens another page lets say openpage.php? if then yes.

Known is handfull, Unknown is worldfull
 
sorry there is another way:
if u r using header then:
header(&quot;location:openpage.php?lnk=$lnk&quot;);

Known is handfull, Unknown is worldfull
 
Thanks! Your knowledge not only seems infinite but rather useful to!!!

Reality is built on a foundation of dreams.
 
dont u read my sign:
Known is handfull, Unknown is worldfull

no one can have infinite language...
:)

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top