Results 1 to 4 of 4

Thread: [RESOLVED] remember check box selections...

  1. #1

    Thread Starter
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Resolved [RESOLVED] remember check box selections...

    PHP Code:
    <form method="post"> 
        <input type="checkbox" name="size[]" value="m">
                 <input type="checkbox" name="size[]" value="l">
                 <input type="checkbox" name="size[]" value="xl">
                 <input type="submit" name="go" value"Submit This"> <strong>Tomato Margherita - </strong> fresh tomato, olive oil, fresh basil, oregano and mozzarella<br>
                    <?if ($go and $HTTP_POST_VARS['size']){
                    //$size = $HTTP_POST_VARS['size'];
                    //echo $size[1];
                    foreach ($size as $f) {
                    echo $f."<br />";
                    }                
                    } ?>
    when this is submitted it displays the correct info, but does not maintain the checked boxes...
    here is the site
    http://www.questfor3d.com/phptest/FoodOrder.php
    Last edited by damasterjo; May 10th, 2006 at 11:01 AM.
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  2. #2

    Thread Starter
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: remember check box selections...

    bump
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  3. #3

    Thread Starter
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: [RESOLVED] remember check box selections...

    PHP Code:
                <form method="POST"> 
                    <? if ($_POST['size1']) {?>
                        <input type="checkbox" name="size1" value="m" checked>
                    <?} else { ?>
                        <input type="checkbox" name="size1" value="m">
                    <?}?>
                    <? if ($_POST['size2']) {?>
                        <input type="checkbox" name="size2" value="l" checked>
                    <?} else { ?>
                        <input type="checkbox" name="size2" value="l">
                    <?}?>
                    <? if ($_POST['size3']) {?>
                        <input type="checkbox" name="size3" value="xl" checked>
                    <?} else { ?>
                        <input type="checkbox" name="size3" value="xl">
                    <?}?>
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] remember check box selections...

    <input type="checkbox" name="size1" value="m"<?=$_POST['size1'] ? ' checked="checked"' : ''>

Posting Permissions

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



Click Here to Expand Forum to Full Width