php - Get value when an html link is clicked -


is possible value of text in anchor tag when link clicked? e.g if have <a href="#">tables</a> possible retrieve value "tables" in variable session variable , use across pages? have several categories of items(which links) , want able value of category clicked , use pull products listed in category database. thanks.

edit: tried <a href="#" onclick= "<?php $_session[value] = "table" ?>">table</a> didn't value. apologies, should have posted earlier

as posted, code not submit php never processed:

<a href="#" 

when have "#" href value, no new request submitted. however, can modify anchor submit category php script this:

<a href="yourscript.php?category=table">table</a> 

then in yourscript.php can read value using $_get:

$selected_category = $_get['category']; // 'table' 

to set value in session, first sure have started session near top of script:

session_start(); 

then save value this:

$_session['selected_category'] = $_get['category']; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -