0
    <li>
        Assign Task to Every User? &nbsp; &nbsp; 
        <input type="checkbox" name="display_insert_email" onchange="this.form['email'].hidden=this.checked" />
    </li>
    <li>
        <input type="text" name="email" style="width: 400px;" value="<?php if ($task_member_id > 0){ echo $task_member_email; } else 'Please enter email address of user'?>" onclick="if(this.value=='Please enter email address of user'){this.value=''}" onblur="if(this.value==''){this.value='Please enter email address of user'}" >
    </li>

These are the two areas in question, if the value of the $project_member_id = 0 I would like the check box to be checked..

I have searched and searched but I cant find anything on this that is relevent to me, I may be searching the wrong things, but Any help would be greatly appreciated!

4 Answers 4

1
<input type="checkbox" <?php if($var == '0'){ ?> checked <?php } ?>/>
Sign up to request clarification or add additional context in comments.

8 Comments

Input is a self closing tag :)
@Mr.Alien but i posted it in 30seconds :D , almost before the user posted the question, i'm superman
Also in this case it will be better to echo checked rather than opening and closing php tags multiple times
Not the downvoter but it's not a race, just give good answers and complete answers :)
lol i'm not racing i'm running out, the problem is i took -1 WITHOUT ANY REASON , (as usual) LOL
|
1

Simply echo checked if the condition is true

<input type="checkbox" value="1" <?php if($val == '1') {echo 'checked';} ?> />

Comments

1

<input type="checkbox" value="1" <?php if($project_member_id == 0) echo 'checked="checked"'; ?> >

Comments

1

<input type="checkbox" <?php if($variable == 1){ echo "checked"; } ?> >

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.