Thread: Check Box?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    65
    Rep Power
    14
    Hi, i am trying to create few check box in one page without a submit button, and there are 5 have which is some with this. User only able to click submit in the last page after he make a selection after these 5 page.

    How can it keep the selected check box so that i can process in last page...

    I had heard there are one way to create a onclick function inside check box but how?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    mfkoo,

    you can use onClick event to submit your form values.

    <form name="f1" method="post" action="second.php3">
    <input type="checkbox" name="C1" value="ON" onSelected="document.f1.submit();">
    </form>

    then you can store these values in some variable for further processing.


    ################-------

    i would suggest you another option for solving your problem.

    place a next command button(Next>> ) in each and every page.when user clicks on next button it should show the next page and it can store the value in a session variable or in a hidden text field.

    In last page just you can use the submit button for passing this values to the database.




    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    65
    Rep Power
    14
    Thanks you for your reply.....

    Here i have three question..

    1. To add a onclick function into the check box, do i need the javascript to do that?

    2.The function onselected, is it run when user check the check box. If so, I need to run a process also when use uncheck it.

    3. I have thinking of the second suggestion.But the flow of the page i want is not to control the user during thier selection. I want them to choose a any topic to edit and select what they want in every topic.

    I hope you can help me up....
  6. #4
  7. No Profile Picture
    freebsd
    Guest
    Devshed Newbie (0 - 499 posts)
    >>1. To add a onclick function into the check box, do i need the javascript to do that?

    Go to http://www.essex1.com/people/timothy/js-index.htm and take a look at "RB LEAP TO 1".

    >>2.If so, I need to run a process also when use uncheck it.
    You need to make an alert confirmation box to do it. Anyway, your idea of using checkbox without submit button is extremely BAD idea in the first place in your case. Visitors will not be able to make any changes (check another box in case a mistake was made). So I suggest you to follow Shiju's idea of making a "next" button (submit button).

    >>3).I want them to choose a any topic to edit and
    >>select what they want in every topic.
    Then do not do it without a <input type="submit" name="submit" value="Next">
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    65
    Rep Power
    14
    >>2.If so, I need to run a process also when use uncheck it.
    You need to make an alert confirmation box to do it. Anyway, your idea of using checkbox without submit button is extremely BAD idea in the first place in your case. Visitors will not be able to make any changes (check another box in case a mistake was made). So I suggest you to follow Shiju's idea of making a "next" button (submit button).
    =========================

    Here, i have miss out one thing to make u clear. I do have a submit button in to button of my page. But, each page's check box is using the same button *the user choose different topic, the page will refresh and "include" the topic.inc file depends on topic. Inside topic have 5 check box. So, user will run throught the 5 topic and finally on click on the submit button to run the transaction. This mean i need to keep the selected value of the 5 topic with 5 check box.....Is that clear????I hope so....


    If it is still unclear, i think there is a site http://www.msn.com/personalize/default.asp?CAT=388

    there is the site i want to develop....

  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15



    <<you can use onClick event to submit your form values.

    <form name="f1" method="post" action="second.php3">
    <input type="checkbox" name="C1" value="ON" onSelected="document.f1.submit();">
    </form>


    mfkoo,

    i supposed to write onClick event in that check box.

    That should be:

    <input type="checkbox" name="C1" value="ON" onClick="document.f1.submit();">

    ###########-############--##########


    i will explain you now how you can do this with next buttons.


    i am giving the file name test.php3 for your script.

    when you run this test.php3 it should display first set of check boxes.after that you can track this information using next buttons.


    test.php3

    <?

    if($action1=="next"){
    //when user clicks on first next button then

    echo "<form method="post" action="test.php3"n";

    echo "<input type="hidden" name="c1" value="$c1">n";

    //get the values from first set of check box
    into hidden text boxes for further processing.

    echo "<input type="hidden" name="c2" value="$c2">n";
    echo "<input type="hidden" name="c3" value="$c3">n";
    echo "<input type="hidden" name="c4" value="$c4">n";

    echo "<input type="hidden" name="c5" value="$c5">n";

    // now show him second set of check box

    echo "Check Box 6: <input type="text" name="c6">n";

    echo "Check Box 7: <input type="text" name="c7">n";
    echo "Check Box 8: <input type="text" name="c8">n";
    echo "Check Box 9: <input type="text" name="c9">n";
    echo "Check Box 10: <input type="text" name="c10">n";

    echo "<input type="submit" name="action2" value="Next" >n";

    echo "</form>n";
    }
    elseif ($action2=="next"){

    //do same thing as above hide all the check box values and show the next set of check boxes.
    }
    elseif ($action3=="next"){
    ..........

    }
    elseif ($submit=="Submit"){

    ///save your record... here

    }
    else{

    //Show him first set of check here


    echo "<form method="post" action="test.php3"n";

    echo "Check Box 1: <input type="text" name="c1">n";

    echo "Check Box 2: <input type="text" name="c2">n";
    echo "Check Box 3: <input type="text" name="c3">n";
    echo "Check Box 4: <input type="text" name="c4">n";
    echo "Check Box 5: <input type="text" name="c5">n";

    echo "<input type="submit" name="action1" value="Next" >n";

    echo "</form>n";
    }


    i don't know whether this logic is clear to you or not..

    tell me ,if you have any problem doing this..








    ------------------
    SR -
    shiju.dreamcenter.net

    "The fear of the LORD is the beginning of knowledge..."
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    65
    Rep Power
    14
    First, thanks so much you willing to spending time with this discussion....

    OK, i will tell you the whole senario now......


    Actually, there are two important page..

    page1--- mainpage.phtml

    this page will detect the user's cookies, it not exit display the default page/default topic(some hot news of the day)
    else,get the cookies value and check what user want to see from my page(example- news,sport,game)
    From this page, user able to edit thier personal option by clicking "edit" and go to userpersonalize.phtml page.


    page2--- userpersonalize.phtml
    In this page, there are two important part, one part is something "button" but not a submit button, and with only one submit button in the last columm. And next part is the is a check box section which will display different check box depend on what topic "button" user click(this means i used include function), say "news", "sports" and "games"

    So, lets see how i create the check box section.
    There are say, three include file
    file1-- news.inc

    this file only content a table with only check box. nch1,nch2,nch3. This table will display in userpersonalize.phtml when user chose the "edit news"(it is a link which pass the "news" value to the same page during refersh the userpersonalize.phtml
    When this page detect the value is "news", it will include the news.inc in selection part. This mean the userpersonalize.phtml is a dynamic page which will always changing depend on user clicking which topic to edit.
    So, if user choose the news topic in first time and "check" some check which they would like to see and then click the next topic say, "sports". My page will able to store which check box user had checked in the "news"(without any transaction with submit button)and display the "sport" check box.

    file2-- sports.inc
    **some senario with file1

    file3-- games.inc
    **some senario with file1

    So, after user have select what they want throught the three topic, he/she can click the submit button in the bottom of the userpersonalize.phtml and finaly, my code will correct all the option user have selected/checked and store in the cookies.


    Do this clear to you?? I hope you understand it, if not, i think i should get your email address and send a drawing structure to you is better.....

    my email is kmf165@hotmail.com

Similar Threads

  1. To check what's in a check box?
    By coverman in forum PHP Development
    Replies: 6
    Last Post: January 19th, 2004, 09:17 PM
  2. Access: list box/combo box "After Update" problems
    By hlove in forum Database Management
    Replies: 2
    Last Post: January 2nd, 2004, 01:22 AM
  3. Do compilers optimize some / into *?
    By Jason Doucette in forum C Programming
    Replies: 46
    Last Post: December 25th, 2003, 08:47 PM
  4. check box form submission resulting in user poll results
    By silaskane in forum HTML Programming
    Replies: 2
    Last Post: December 19th, 2003, 10:23 AM
  5. check box form submission resulting in user poll results
    By silaskane in forum PHP Development
    Replies: 1
    Last Post: December 18th, 2003, 09:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo