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.

Link to comment
Share on other sites

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 ??

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.