Can't get this code to work...

From: Date: Sat, 06 Apr 2002 04:31:15 +0000
Subject: Can't get this code to work...
Groups: php.general 
Request: Send a blank email to php-general+get-91828@lists.php.net to get a copy of this message
Sorry for the vague Subject, but I have this code that looks fine to me. There's some logical error, because I can't get to the second if statement, although when I echo "\$".$cb[$i] I get $checkboxName. If I hard code $checkboxName it will work though. Anyone know why? TIA! $num_fields= 8 ;//the number of fields on the form! $cb=array("Name", "Address", "State", "Zip", "Phone", "Email", "Comments", "Fax"); for($i=0; $i<$num_fields; $i++){ if ("\$".$cb[$i] !="") { // CAN GET HERE if ("\$checkbox".$cb[$i]=="validate") {echo"can NOT get here";// HINT, HINT $form_write_msg .= 'if (!$cb[$i]) {$error_msg.="Your " . $cb[$i] . " .\n";} if ("\$".$cb[$i]){ $msg.="\$".$cb[$i].": \t" . $cb[$i] . " . \n";} ' ;}elseif("\$checkbox".$cb[$i]=="no") {$form_write_msg.= 'if ("\$".$cb[$i]){ $msg.=$cb[$i] .": \t " .$cb[$i]. " . \n";} ' ;} ;}

« previous php.general (#91828) next »