Thread: Forms Problem

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Posts
    0
    Rep Power
    0
    Hello,

    I am a newbie at programming in PHP, and I have something that has been stumping me.

    I created a PHP page that has a form on it to search my online database. I used CheckBoxes to allow the users to search only certain parts of the DB.

    One checkbox is named "code" and the other is "howto" and both have a value of "1".

    When the form is submitted to my "Search.php" which displays the results $code and $howto always equal "1" even if the checkboxes are not checked.

    Here is the format I used for the checkboxes:
    <input type="checkbox" name="code" value="1">

    I even made sure to set these values on the page with the form to something other than "1" incase they were POSTed from one of the previous pages, but to no avail.

    Any help would be greatly appreciated...

    Thanks,
    Jared Hoylman
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    When the form is submitted to my "Search.php" which displays the results $code and $howto always equal "1" even if the checkboxes are not checked.

    Here is the format I used for the checkboxes:
    <input type="checkbox" name="code" value="1">
    >>


    Actually that shouldn't happend.

    here is an example.you should do similar to the following example.

    <form method="POST" action="<?echo $PHP_SELF;?>">
    Code :<input type="checkbox" name="code" value="1"><br>
    How to :<input type="checkbox" name="howto" value="1"><br>
    <input type="submit" value="Submit" name="submit">
    </form>

    <?
    if($submit=="Submit"){
    echo "Test Values<br>";
    echo $code;
    echo $howto;
    }

    ?>


    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


    "The fear of the LORD is the beginning of knowledge..."

IMN logo majestic logo threadwatch logo seochat tools logo