Jump to content

Is it possible to check a checkbox from the URL?


lovelf

Recommended Posts

I want to be able to have some of the checkboxes in my form already checked only if the user comes from a certain link to the form page.

 

example: http://www.url.com/form.php?check11=checked or http://www.url.com/form.php?check11=checked&check7=checked two different links from previous pages that would automatically check a checkbox.

 

I have no clue how to make this work.

Somebody helped me with this code which works great but I need to make it work inside an iframe..

 

 

<input type="checkbox" name="foo" <?php if($_GET['check11'] == "checked") echo "checked=\"checked\""; ?> />

 

how would it be?

 

pagecontainingiframeurl?form.php?check11=checked ??

ok. I got it.. and it works great.

 

<?
if($_GET['db'] == "y") echo <<<html
<iframe frameborder=0 width=780px height=650px src=http://www.siteurl/contactb.php?check11=checked></iframe>
html;
?>

<?
if($_GET['db'] == "n") echo <<<html
<iframe frameborder=0 width=780px height=650px src=http://www.siteurl/contactb.php?check12=checked></iframe>
html;
?>

<?
if($_GET['db'] == "r") echo <<<html
<iframe frameborder=0 width=780px height=650px src=http://www.siteurl/contactb.php?check11=checked&check12=checked></iframe>
html;
?>

<?
if($_GET['db'] == "z") echo <<<html
<iframe frameborder=0 width=780px height=650px src=http://www.siteurl/contactb.php></iframe>
html;
?>

 

One final question, could I set the "db=z" as a default to be shown in case there is no db=y , n , or r in the URL?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.