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

05-31-2007, 01:52 PM
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.

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:

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

header("Location: backToMainPage");

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