Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Checkbox Input

  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Checkbox Input

    Hey guys!

    I'm kind'a stuck in this problem:
    I got a checkbox that I want to have a default value as checked, but when you uncheck it and submit it stays unchecked untill you check it and submit again. (Atleast while you stay on the site and don't close the browser)

    So this is what I got:
    Code:
    <?php
    
    $_POST['RNC101V'] ? $RNC101_Checked = ' checked="checked" ' : $RNC101_Checked = '';
    
    ?>
    
    <div style="width=200px; height=1000; float=right; border=solid 1px;">
    
    	<form method="POST" action"index.php">
    	
    	<input type="checkbox" name="RNC101V" <?php echo $RNC101_Checked ?>/>RNC101<br />
    	<input type="submit"/>
    	
    	</form>
    	
    </div>
    Help is much appreciated!

    Regards
    Jonathan

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,307
    Thanks
    23
    Thanked 612 Times in 611 Posts
    This is the way it is suppose to work. You unchecked it and it stays unchecked . You don't want your boxes to do what ever they want.

    The checked="checked" attribute sets the initial condition.

    BTW Your code will not work.

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    This is the way it is suppose to work. You unchecked it and it stays unchecked . You don't want your boxes to do what ever they want.

    The checked="checked" attribute sets the initial condition.

    BTW Your code will not work.
    BTW. My code does work, and I managed to fix it by myself... -.-"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •