use javascript variable ina php code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ishakya
Forum Commoner
Posts: 40
Joined: Tue Jan 04, 2011 4:58 am

use javascript variable ina php code

Post by ishakya »

Hi all,
I am saving some check box ids in a java script variable when a check box is clicked.
So after that i need to pass that variable to a another page via url in a php code....
so can anyone please help me to solve this.....

Thanks in advance
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: use javascript variable ina php code

Post by social_experiment »

Data passed via the url can be accessed by using the $_GET associative array. If you have a url like this page.php?id=5 then $_GET['id'] will contain the value of 5.
Always check input retrieved from urls so they match your specific criteria.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply