...

View Full Version : how to display the selected checkbox id?



bhagyaa2ze
05-31-2007, 01:52 PM
hi,
Iam new to php.

I created a list of check box,if i select a indvidual check box,then it must go to the indvidual pages on the basis of selection.

Please help me how to code for this.

thanking you.

LaRoza
05-31-2007, 06:08 PM
I am assuming you are familiar with php, and just have a problem with a form,



if(isset($_GET['controlName'])) {
echo "You selected $_GET['controlName']";
}


the function isset() returns a boolean value, based off of the existance of a variable, in this case the $_GET[] global variable, when the controls name is 'controlName'.

For your page, I would set the action to a page which has code like this:



if(isset('_GET['controlName']))
{
$url = $_GET['controlName'];
if($url == 'google')
{
header("Location: http://www.google.com");
}
if($url == 'live')
{
header("Location: http://www.live.com");
}

}
else
{
header("Location: backToMainPage");
}


A switch statement would have been better in this case, but this is just an example.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum