PHP Ferrari
PHP Ferrari

Reputation: 15616

Save value in PHP Session variable

I have an html table which contains records, comes from mysql db. Each row also contains id (PK) wrt db table record. Now I want to save record id in PHP Session variable, when I click on a row. To do this I used onclick property for each row & call a javascript function with record id as function parameter & it works fine but how could I save this id in PHP Session variable ? Thanks.

Upvotes: 0

Views: 3001

Answers (2)

sushil bharwani
sushil bharwani

Reputation: 30187

To do this you probably need to use ajax. Which is where on a click event you could probably call a different php to save your values in session

Upvotes: 0

Sarfraz
Sarfraz

Reputation: 382696

That's not possible because PHP is server-side language. However, you can use ajax for that.

Here is an ajax tutorial:

http://www.w3schools.com/Ajax/Default.Asp

Upvotes: 1

Related Questions