Re: does anyone know how to do this???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sorry I just read more carefully.

Here's the PHP side of that.

for($i=1;$i<=$msg_count;$i++){
    if($_POST['MSGS'.$i]=='ON'){do this)
}

You can also use the $$ operator.

$i = 1;
$myvar = 'MSGS'.$i;
$$myvar is now equivalent to $MSGS1

So

for($i=1;$i<=$msg_count;$i++){
    $myvar = 'MSGS'.$i;
    if($$myvar=='ON'){do this)
}

But this assumes that you have  register_globals turned on which most
servers are turning off because of how insecure sloppy code can be.  I just
include it becasue the $$ trick is neat.  You should use the $_POST[''] form
above.

have fun

-jmb


----- Original Message ----- 
From: "Jeff Bennett" <JBennett@Earthling.net>
To: <php-objects@yahoogroups.com>
Sent: Sunday, September 19, 2004 12:16 PM
Subject: Re:  does anyone know how to do this???


>
> Here you go.
>
> <script language="javascript" type="text/javascript">
> function checkAll()
> {
> for (var i=1;i<=3;i++)
>     document.messages["MSGS"+i].checked = document.messages.MA.checked;
> }
> </script>
>
> -jmb
> ----- Original Message ----- 
> From: "Jason" <jason@haffey.com>
> To: <php-objects@yahoogroups.com>
> Sent: Saturday, September 18, 2004 6:05 AM
> Subject:  does anyone know how to do this???
>
>
> > I have been racking my brain to figure out how they do this...
> >
> > If you go to just about any web based email, you will have Check
> > Boxes down the side next to each email.  There is the one check box
> > at the top that if you click, all the rest "check up".  That part
> > already did (with javascript) but then when I try to do a deleted,
> > mark read, or etc. I cant figure out how to run a loop to check each
> > checkbox.
> >
> > here is the basic code I have...(the HTML)
> >
> > <script language="javascript" type="text/javascript">
> > function checkAll()
> > {
> > document.messages.MSGS1.checked = document.messages.MA.checked;
> > document.messages.MSGS2.checked = document.messages.MA.checked;
> > document.messages.MSGS3.checked = document.messages.MA.checked;
> > }
> > </script>
> >
> > <input type="checkbox" name="MA" onclick="checkAll();"></td>
> > <input type="checkbox" name="MSGS1" value="ON"></td>
> > <input type="checkbox" name="MSGS2" value="ON"></td>
> > <input type="checkbox" name="MSGS3" value="ON"></td>
> >
> > and so on......
> >
> > but when I click the submit button I run into an issue as I dont know
> > how to do a loop that can create the term:
> >
> > for($i=1;$i<=$msg_count;$i++){
> >     if(MSGS$i==true){do this)
> > }
> >
> > I did try to do an array but that didnt work with my loop nor my
> > javascript:
> >
> > <script language="javascript" type="text/javascript">
> > function checkAll()
> > {
> > document.messages.MSGS.checked = document.messages.MA.checked;
> > document.messages.MSGS.checked = document.messages.MA.checked;
> > document.messages.MSGS.checked = document.messages.MA.checked;
> > }
> > </script>
> >
> > <input type="checkbox" name="MA" onclick="checkAll();"></td>
> > <input type="checkbox" name="MSGS" value="ON"></td>
> > <input type="checkbox" name="MSGS" value="ON"></td>
> > <input type="checkbox" name="MSGS" value="ON"></td>
> >
> >
> > I just want to finish this part of my script so if anyone is willing
> > to help me out so I can move on I would be really really happy,
> > thanks in advance.
> >
> >
> >
> >
> >
> > PHP Data object relational mapping generator -
> http://www.meta-language.net/
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>
>
>
>
> PHP Data object relational mapping generator -
http://www.meta-language.net/
> Yahoo! Groups Links
>
>
>
>
>
>
>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux