PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 28th, 2000, 08:46 PM
mfkoo mfkoo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 65 mfkoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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?

Reply With Quote
  #2  
Old May 29th, 2000, 01:57 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan
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..."

Reply With Quote
  #3  
Old May 29th, 2000, 02:54 AM
mfkoo mfkoo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 65 mfkoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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....

Reply With Quote
  #4  
Old May 29th, 2000, 03:20 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>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">

Reply With Quote
  #5  
Old May 29th, 2000, 09:42 PM
mfkoo mfkoo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 65 mfkoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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....


Reply With Quote
  #6  
Old May 30th, 2000, 03:49 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan



<<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..."

Reply With Quote
  #7  
Old May 30th, 2000, 09:09 PM
mfkoo mfkoo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 65 mfkoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Check Box?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap