Jump to content

Recommended Posts

Hi,

 

I am creating an email form with checkbox included.

 

And I need the checkbox to be ticket when I enter the form though links.

 

IE

 

List of checkbox's

 

checkbox 1

checkbox 2

checkbox 3

checkbox 4

 

say I was another page and I click on a link (call the link checkbox 1) I would like the checkbox to be ticked automatically.

 

I know this makes no sense but I hope you get the idea.

 

Thanks in advance.

 

Lee

Link to comment
https://forums.phpfreaks.com/topic/55062-checkbox-question/
Share on other sites

You need the checked="checked" attribute of the HTML <input /> tag...

 

you could do sth like this... if i understand what you need...

<?php
if ($_GET['checkbox1'] == "check")
{
     $check1 = ' checked="checked" ';
}
echo '<input type="checkbox" name="name" value="value"'.$check1.'/>';
?>

 

any variation to make the above code more effective is what you need, especially if you have more checkboxes but i guess you get the point... this is it more or less...

Link to comment
https://forums.phpfreaks.com/topic/55062-checkbox-question/#findComment-272201
Share on other sites

that is what i am saying in my post...

 

you just have to add checked="checked" to the checkbox you want checked. if you want to do it using $_GET vars you should check the vars

if (isset($_GET['check']))
{
    switch($_GET['check'])
    {
          case 1:
            $check1 = ' checked="checked" ';
          case 2:
            $check2 = ' checked="checked" ';
    }
}

i hope i am understandable now...

Link to comment
https://forums.phpfreaks.com/topic/55062-checkbox-question/#findComment-272211
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.