Re: [PHP] Can't get this code to work...
Dan, Really, thanks for the help. Yeah, as you know I'm not experienced near enough with PHP. Maybe you could provide me with an e-mail and prices for consultation(I suppose this is what 'Analysis & Solutions' does?) Regards, Robert Packer "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis & Solutions wrote: > > > > > > And following up to my own following up... As I shut down the computer, > I realized I made a boo boo. The single quotes shouldn't be there. So, > make that: > > > Later, > > --Dan > > -- > PHP scripts that make your job easier > http://www.analysisandsolutions.com/code/ > SQL Solution | Layout Solution | Form Solution > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get this code to work...
On Sat, Apr 06, 2002 at 12:32:33AM -0500, Analysis & Solutions wrote: > > And following up to my own following up... As I shut down the computer, I realized I made a boo boo. The single quotes shouldn't be there. So, make that: Later, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get this code to work...
On Fri, Apr 05, 2002 at 09:42:37PM -0500, Analysis & Solutions wrote: > If you want to evaluate the variable $checkboxName, you need to write: > >$var = "checkbox$cb[$i]"; >if ($$var == 'validate') > > But, of course, that assumes you actually set the name of your > checkbox to "checkboxName" and the value of that checkbox to "validate" Pardon my following up to myself, but I figured it'd be a good idea to do so. I was initially going to suggest your method of coding seems quite wacky. Then, I figured, hey, let them do what they want. Now, I've thought better of it. A far simpler way to achieve what it seems you're trying to do is to use an array in the first place. Then in your receiving code, you could just do if ($checkbox['Name'] == 'validate') { Or, if you want to loop through each item, as you were in your original code: while ( list($Key,$Val) = each($checkbox) ) { if ($Val = 'validate) { $msg .= "$Key : $Val\n"; # or whatever it was you were trying to do... } } WAY cleaner and WAY more flexible. Now you can add new items to the form without having to name them in your $cb[] array. Also, FYI, there was no need to set the array using $cb[$i]. Just doing something like $cb[] = 'some value'; works just fine, with the key being automatically numbered/incremented, starting at 0. Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get this code to work...
Hey Rob: On Fri, Apr 05, 2002 at 08:31:15PM -0800, Rob Packer wrote: > if ("\$checkbox".$cb[$i]=="validate") > {echo"can NOT get here";// HINT, HINT Because you're making a string "$checkboxName" Of course it doesn't equal "validate" If you want to evaluate the variable $checkboxName, you need to write: $var = "checkbox$cb[$i]"; if ($$var == 'validate') But, of course, that assumes you actually set the name of your checkbox to "checkboxName" and the value of that checkbox to "validate" Enjoy, --Dan -- PHP scripts that make your job easier http://www.analysisandsolutions.com/code/ SQL Solution | Layout Solution | Form Solution T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Ave, Brooklyn NY 11232v: 718-854-0335f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php