CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
help

 



datlaravi
Deleted

Jun 21, 2000, 8:14 AM

Post #1 of 3 (310 views)
help Can't Post

I have a question. I am doing some search in a form. I have 3 checkboxes. I have given same name to all the 3 checkboxes. and values different.
for example
<input type ="checkbox" name ="search" value =1>
<input type ="checkbox" name ="search" value =2>
<input type ="checkbox" name ="search" value =3>
I was getting those values in
@array = $query->param('search'); (This will give checked values)
I was able to write code to each one
foreach $key (@array) {
if ($key ==1){
do this
}
elsif ($key ==2) {
do this
}
If the user checked 2 checkboxes at a time, how do get the condition.
Please send me mail. I will wait for your response.
Thanks




monocle
User

Jun 21, 2000, 8:39 AM

Post #2 of 3 (310 views)
Re: help [In reply to] Can't Post

I might suggest you give each checkbox a value similar to binary values or the way you determine a chmod value. This way you can add up the total of all checked boxes and come up with a unique value for that particular senerio.

example:
<input type ="checkbox" name ="search" value =1>
<input type ="checkbox" name ="search" value =2>
<input type ="checkbox" name ="search" value =4>

senerio #1:
user checks box 1 and 2. value would be 3 (1 + 2 = 3)

senerio #2:
user checks box 1 and 3. value would be 5 (1 + 4 = 5)

senerio #3:
user checks box 2 and 3. value would be 6 (2 + 4 = 6)

Now just test for the individual senerio values.

This may seem a bit crazy, but with out having more information about what you are trying to do... it sounds crazy anyway.

Hope this helps.

Monocle
Hear great techno by Monocle at http://www.mp3.com/monocle . Cd now on sale!


monocle
User

Jun 21, 2000, 8:59 AM

Post #3 of 3 (310 views)
Re: help [In reply to] Can't Post

I might also suggest that you not post this over and over the same way in many forums. If noone has answered you, it is for a reason.
1) they do not understand the vague situation you describe.
2) they do not know the answer.

Suggestion to help you:
1) Give it a day or two. This board is not crawling with Experts that are just waiting for new posts to answer. Free help may only cost you a little time waiting

2) Try to reword the question with as much detail as posible. It is very difficult to diagnos a problem when you are not seeing it unfold.

3) Try to put actual code in your post. Again, it is hard to debug a script when you can't see the script.

I am not trying to be a jack-ass, but I am trying to help you maybe get better results from this forum.


------------------
Monocle
Hear great techno music by Monocle at http://www.mp3.com/monocle. CD now on sale!


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives