Jul 24, 2008

How Handle Sending Back Multiple Checkboxes

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

How Handle Sending Back Multiple Checkboxes

kvarnerexpress
I know how to send back the check-boxes, so that's not the issue.

I have a form that contains a group of 5 check-boxes.

The user could select none, one, all, or any combination in between.

I'm working on form validation right now and am doing most of it server side. The validation is set so that if the user has to go back all their data is retained.

I'm using case statements, which work wonderfully, but in this circumstance I don't know what would be the best method that allows for a multitude of combinations. I think there is a possibility of something like 120 different combinations.

What I want is for the check-boxes that were selected to be checked when it's sent back to the form.

Would it be better to just send each box as its own separate entity and evaluate it that way?

Thanks!
kvarnerexpress

Reply

littleweseth
QUOTE(kvarnerexpress @ Aug 26 2005, 09:31 PM)
I know how to send back the check-boxes, so that's not the issue.

I have a form that contains a group of 5 check-boxes.

The user could select none, one, all, or any combination in between.

I'm working on form validation right now and am doing most of it server side. The validation is set so that if the user has to go back all their data is retained.

I'm using case statements, which work wonderfully, but in this circumstance I don't know what would be the best method that allows for a multitude of combinations. I think there is a possibility of something like 120 different combinations.

What I want is for the check-boxes that were selected to be checked when it's sent back to the form.

Would it be better to just send each box as its own separate entity and evaluate it that way?

Thanks!
kvarnerexpress
*


I'd try something like the following :
CODE

...
<?php
 $postvars = $_POST;
 if ( ServerSideValidate ( $postvars ) == okay )//do your server side validation here.
   redirect to a nice 'thankyou for filling in our form' page. Not sure how to do this right now.
 else
   proceed to the next bit.
?>
<form method="post" action="<?php $_SERVER['PHP_SELF']?>">
//the php_self bit makes it so the form submits to itself, so the code above can validate and either pass the user on or give them another try at the form.
 <input method="checkbox" name="cb1" value="<?php if ( isset ($postvars['cb1'] ) ) print $postvars['cb1']; else print "";?>">
 // What this does is check if the cb1 variable is filled from a previous try at the form. If it is, the value is put back in, else nothing is printed.
 ... and so on for cb2, cb3, cb4, cb5.
 </input>
</form>


What that does is :
- If the user is seeing the form for the first time, no POST variables will exist, and so the form is in a default state.
- When the user submits, the form submits to itself. At the top of the code is your validation code, and if the data passes you redirect the user to your nice little 'thanks' page. Otherwise, continue to the juicy bit.
- IF the user doesn pass your validation, then the next bit comes in. The user's already submitted some postdata, so it's there in the $_POST global. What the bit of code inside the 'value' attribute does is put the data back.

Should work : i haven't checked it and you may need to tweak to taste, but that's the basic method.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : handle, sending, back, multiple, checkboxes

  1. How To Open Multiple Tabs?
    (6)
  2. Sending Free Sms Over Internet!
    (2)
    New online services have been set up that transit your message from their station using a form on
    their website. You can just Google Search for "free SMS over internet" or something else of the kind
    /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> . One of the
    reliable services I have found is text4free.net . They can send SMS on a huge range of providers
    and even have a online provider checker - when you send an SMS you need to know the network provider
    of the recipient and the online checker can do this for you! They also all....
  3. Help Me, Lost Skill Suddenly
    Can you help me to get me back fit? (2)
    This may sounds full of lie, but it's true and I need help About a month ago, I was a
    competitive player, at least in the server I always play. But somehow, around 2 or 3 weeks ago, I
    don't know why I feel like I lost my skill almost completely. My KDR (Kill Death Ratio, or kill
    divide by death) usually around 2 or higher, but now, I only can get less than 0.5. Even I
    remembered 3 days ago, I get 3 kills and 15 deaths. This is somehow frustrating me. I've
    practice harder (by vs bots, OMG! and going at deathmatch server), but when I arrive there, at
    the se....
  4. Sending E-mails Based On Intervals?
    (7)
    Again, I need your help. I have two database entries, let's say "reg_users" and "news". The
    question is that if somethings was changed in the "news" database, the email letter will be sent
    automatically to all emails which are related to "reg-users" database. So, how can I accomplish this
    point. How can I set this process based on daily, weekly or monthly basis?....
  5. Bruney Could Be Back By Break
    (0)
    Brian Bruney has been cleared to throw from 60 feet, and could make his way back this season, as
    early as the All-Star break. Bruney was lights-out during the first few weeks of the season. with
    Joba in the rotation, Bruney's comeback could significantly improve the pen.....
  6. Sig Pop Rate Please
    I made it a while back (2)
    This is one of my inferior sigs. I'm currently not on my computer but when I am I will post my
    other sigs that I have but rage this one though /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" /> I decided to go crazy with filters XD....
  7. Sending E-mails After News Update?
    Coding needed?!? (8)
    I need the following code or the idea how to reach this concept. Let's say, I have a database
    entry which is called "news", where all of the news stories are stored. If this database entry got
    modified, like the new post was added to the web-site by an administrator, the registered users will
    get some kind of email notification automatically, I mean the mails are sent automatically without
    the interaction of someone else. ....
  8. Get Back Lots Of Disk Space
    Windows XP/Vista MCE (Media Centre Edition) (7)
    So, some of you might know about this already but, anyways... The other day I was trying to install
    a game but did not have the necessary disk space, so I deleted files that I will not use, and other
    files that I do not need... I compressed some files that I might use later in the future... And just
    doing that got me back around two to three gigabytes of free hard disk space... But that's not
    enough, the game needed 6 gigabytes of free disk space! So what did I do next? I ran CCleaner...
    It took a while yes, but soon it free'd another 2 gigabytes... ARRGH&....
  9. Saint Michael Is Back And Spunkier Then Ever
    (8)
    I would have spammier then ever in the topic but that would just be plain wrong and warnings and
    bans would be tossed, threats would be given and utter chaos and what not /laugh.gif"
    style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" />. Anyway, I am back from
    my vacation and instead of going through pages upon pages, upon pages of posts which is like 20 some
    odd pages if I counted the two times I visited. For those who don't remember or rather
    didn't care (points to that guy), I went on vacation to see my relatives I haven't seen in 3
    ....
  10. Back From First Year At College
    (2)
    Well, I just finished my first year of college and well the freshmen 15 is a real phenomena. Except
    i gained the freshmen 20!! I have never really been THAT active of a weight lifter but I
    would like to gain some muscle mass and just get into general better health. Any tips, pointers,
    ideas, diet and weight lifting facts and what have you would be greatly appreciated. Thanks!....
  11. Multiple Page Titles
    Multiple Page Titles (1)
    A really cool script. It allows you to put up to 6 page titles for one page and everytime you
    refresh the page it alternates the title... It might help increase your Google Page rank I hope you
    will like it. "Massive Respect" /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" /> /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
    <script LANGUAGE="JavaScript"> var numb = 5 title_text = new Array(); title_text = "Your
    Site Name here - Discription here"; title_text = "Your Site Name here - Discription ....
  12. Site Back Online, But....
    Works on anyone's machine but mine. (20)
    I got a reply from Xisto today that my site was up and running again. Yet, when I surf to it, it
    will not load, also, my email client keeps telling me the POP3 server (the one related to my domain)
    timed out. My Cpanel will not open neither. On my son's laptop (on the same network, hence same
    IP address) the site loads immediately. Has anyone got any idea what the problem my end could be?
    Thanks.....
  13. I Have A Dodgy Back... Need Some Tips Please.
    (12)
    I hurt my back a few weeks ago and it seems to be easing up a little now. Ive just been resting and
    it seems to work for it. It's my lower back and i was just thinking if anyone had any tips for
    sleeping or how to keep it loose so it don't go stiff again. Thanks....
  14. I Have Install Windows 2003 Server
    I want multiple user to login my server (4)
    I have install windows 2003 server and some application like iis, share point, etc.my development
    time want remote desktop for few user so I want multiple user to login my server but I have not
    install active directory and I don’t want to install so tell me the best way to resolved the problem....
  15. Multiple Forum Skins
    To have, or not to have? (6)
    Hey all, I'm just starting up a forum on my hosting here, and I was wondering, how do people
    here feel about having multiple skins? I think just having the default skins that come with the
    forum and maybe one or two added on that match the style of the forum a little better, but what do
    you think? Should I have a dark/light added on, in addition to the default skins? and should I
    leave the forum default as one of the included skins? or something that fits in with my idea of what
    the forum looks like a little better? thanks for your opinions /smile.gif" style="vert....
  16. Rpg Maker 2003 Shifted Game Screen
    need help shifting it back to center (3)
    When I play games made by RPG maker 2000 or 2003, the game screen is always shifted to the
    right. Even after I try to adjust it using the options on my monitor, I still can't see part of
    the game screen. How do i fix this? ....
  17. Start Multiple Programs With One Shortcut
    Windows XP (15)
    Welcome to my turoial on how to start multiple programs using one shortcut. You may probably be
    wondering how this is possible. Well this tutorial will use a language from MS-DOS called batch. I
    am not sure whether it is "language", but I do know that it is a way to program for MS-DOS. Batch is
    simply a way to run several MS-DOS commands with just one command. All batch files are run through
    Command Prompt, but they can be accessed with shortcuts also. Here are a few requirements for this
    tutorial. Requirements Windows XP (I tested this on XP, but it should work on m....
  18. Integrity Checks Failing During Multiple Ajax Request
    somehow the checks fail due to lag. (1)
    Heres my merit system at its current stage. http://sonesay.trap17.com/index.php note: select a
    character from the drop down list to see output. I've been working on this locally on my mac
    and because of little or no delay I did not see the problem until I decided to upload to the WWW.
    The problem lies in the adding of merits to each category. Although there are integrity checks on
    the PHP side before executing the update to mysql database it somehow fails because of the lag. i.e
    multiple 'add' buttons can be pressed before the section gets reloaded. so if....
  19. Multiple Gmail Accounts As Free Online Storage?
    (8)
    I came across this topic which basically says that you can use Gmail to store your files. If
    you're lucky, you get some free gmail invites to be sent to your friends when you open a gmail
    account. Now if you just keep sending the invites to yourself, you'll end up with lots more
    gmail accounts, isn't it? (I've tried it, you CAN create multiple gmail accounts by inviting
    yourself) And that means more storage space if you use each account to store 2 GB of things right?
    Could it possibly rival other premium data backup services online, most importantly....
  20. Send Fake Sms From Your Nokia Phone
    sending SMS with your own From address (14)
    Sending Fake SMS There is a loop hole in Nokia mobile phone using which you can send fake
    SMS messages. i.e you can send a SMS to your friend by changing the from address to some random
    e-mail address. Nokia has a feature called SMS e-mail This feature is used to send e-mail by
    SMS. You network operator will have a SMS e-mail server. You are supposed to send a SMS to the SMS
    mail server with the To address, subject and e-mail body as a partof the SMS text body by following
    the conventions provideded by your Network operator. You SMS server will read the To....
  21. Forgot The Wireless Wpa/wep
    how to find it bacK? (4)
    if i forgot my WPA/WEP for my wireless, how to find it bacK? it is got tools or software can solve
    this type of problem? /huh.gif" style="vertical-align:middle" emoid=":huh:" border="0"
    alt="huh.gif" /> ....
  22. Would You Go On A Trip Into Deep Space?
    Even if you knew you were never coming back... (28)
    As the topic says, if you had the opportunity to go on a deep space mission but you knew it was a
    one way trip, would you do it? Lets say fro arguments sake, that you would see the following
    sights: The moon Mars Jupiter and its moons Saturn and the outer planets. I would like to see what
    everyones opinions are, I would personally do it if I had the opportunity.....
  23. Evilboard (forum Software) - Multiple Categorys - Don't Work :(
    I am creating a forum and i can't fix more then 1 category. (6)
    I am at the moment trying to program my own forum, but i need more then a single category, here is
    my source: CODE function cat () { include("functions/functions.php");
    echo '<table width="100%"  border="0" cellspacing="0">
    <tr> <td class="eb_top" colspan="3" style="border-bottom-width:
    0; height: 30px; font-size: 12px;"> <b>Forum</b></td>
    </tr>';      global $catid;   $db = new db;   $db->connec....
  24. Sending + Receiving Email Via Telnet
    using email via the command line. (8)
    ok first off im no good at writing tutorials so feel free to flame me (hey that rymes). Anyway in
    this tutorial i will basically show you how to send and receive email via the command-line terminal
    emulation program called Telnet. Now where shall i start, hmm.. Sending Email!! Sending
    Email Sending email requires a special type of server called an SMTP server (SMTP -> Simple Mail
    Transfer Protocol). SMTP is the protocol used to send email just like POP is the protocol used to
    receive. Now by default and most commonly SMTP servers run on port 25. To describe ....
  25. Multiple Drop Down Menus W/ Submit Button
    (6)
    I am building a page that will have 2 drop down menus and a submit button. The first menu will have
    one set of options, say colors (red, blue, green, yellow). The second menu will have another set of
    options, say sizes (small, medium, large). What I want to be able do is select a color and a size,
    click submit and have it go to the page for those options. So if a user picks 'Red' and
    'Small' and clicks submit they will be linked to page1.html. If they pick 'Blue' and
    'Large', they will be linked to page2.html, and so on. Any ideas how to ....
  26. Refresh Page After Back Button Hit
    (11)
    Hi. I have a page that is dynamically build through DOM manipulation. So, when I browse outside the
    page, and then click back, those dynamically created DOM objects are gone. Since I am also using JSP
    / Servlet technology, I can rebuild this page easily, which I have done. Here is my dilemma. If
    the user leaves the dynamic page, then clicks back on their browser, I need the page they are going
    back to to refresh. I can't figure out how to do this. I've tried using the META tag, but it
    won't do it. Help would be appreciated. Thanks. ....
  27. How You Handle Awp?
    help... some tips to better AWP handle (19)
    Question tells all! how god u handle awp? please write some tips.... When i shoot i press two
    times q and i have awp reloaded for next shot in 0.5 sec. please write down some your tips to
    better AWP skill. Have a nice day!!!....
  28. Can You Go Back To High School?
    at 34....? (15)
    I've heard of people going back to high school in their later years and I really want to know
    just how likely it would be to be granted permission to go back at the age of 34. I quit in the
    middle of my 11th year and I've never stopped thinking about going back and finishing. It's
    like something I need to do before I die or something. How can I be a good example to my teenager
    is she should decide to quit if I didn't finish myself? So, if anyone out there has any
    information about getting back into high school at my age, please let me know. The infor....
  29. What Website Do You Find Your Always Goin Back To?
    and not trap17 lol (77)
    hey wanted to know what type of site you guys like and wot are the sites you always find your self
    lookin at and checkin for updates. and dont put trap17 /tongue.gif' border='0'
    style='vertical-align:middle' alt='tongue.gif' /> i no its great and that put this topic is about
    other sites /laugh.gif' border='0' style='vertical-align:middle' alt='laugh.gif' /> cheers lil
    chris....
  30. Who Thinks Trap 17 Is Th Best Server?
    Who ever thinks replie back! (6)
    Man you what i think Trap 17 has good and strong Terms of Service that is good But i think they have
    the best hosting program that i love about and it's the best! You know if you do not have
    money right? And you what a good and madly good forum that is so much money you can not afford and
    you wont it now! But Looking and thinkingno money! Some how you end up at trap17 the free
    hosting server that provides free hosting forums and upgrades isn't that so cool?! Tell me
    it is! /cool.gif' border='0' style='vertical-align:middle' alt='cool.gif' />....

    1. Looking for handle, sending, back, multiple, checkboxes

Searching Video's for handle, sending, back, multiple, checkboxes
Similar
How To Open
Multiple
Tabs?
Sending Free
Sms Over
Internet!
;
Help Me,
Lost Skill
Suddenly -
Can you help
me to get me
back fit?
Sending
E-mails
Based On
Intervals?
Bruney Could
Be Back By
Break
Sig Pop Rate
Please - I
made it a
while back
Sending
E-mails
After News
Update? -
Coding
needed?!
?
Get Back
Lots Of Disk
Space -
Windows
XP/Vista MCE
(Media
Centre
Edition)
Saint
Michael Is
Back And
Spunkier
Then Ever
Back From
First Year
At College
Multiple
Page Titles
- Multiple
Page Titles
Site Back
Online,
But.... -
Works on
anyone's
machine but
mine.
I Have A
Dodgy
Back... Need
Some Tips
Please.
I Have
Install
Windows 2003
Server - I
want
multiple
user to
login my
server
Multiple
Forum Skins
- To have,
or not to
have?
Rpg Maker
2003 Shifted
Game Screen
- need help
shifting it
back to
center
Start
Multiple
Programs
With One
Shortcut -
Windows XP
Integrity
Checks
Failing
During
Multiple
Ajax Request
- somehow
the checks
fail due to
lag.
Multiple
Gmail
Accounts As
Free Online
Storage?
Send Fake
Sms From
Your Nokia
Phone -
sending SMS
with your
own From
address
Forgot The
Wireless
Wpa/wep -
how to find
it bacK?
Would You Go
On A Trip
Into Deep
Space? -
Even if you
knew you
were never
coming
back...
Evilboard
(forum
Software) -
Multiple
Categorys -
Don't
Work :( - I
am creating
a forum and
i can't
fix more
then 1
category.
Sending +
Receiving
Email Via
Telnet -
using email
via the
command
line.
Multiple
Drop Down
Menus W/
Submit
Button
Refresh Page
After Back
Button Hit
How You
Handle Awp?
- help...
some tips to
better AWP
handle
Can You Go
Back To High
School? - at
34....?
What Website
Do You Find
Your Always
Goin Back
To? - and
not trap17
lol
Who Thinks
Trap 17 Is
Th Best
Server? -
Who ever
thinks
replie
back!
advertisement



How Handle Sending Back Multiple Checkboxes



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE