[FX.php List] Editing Checkboxes

Joel Shapiro jsfmp at earthlink.net
Wed Oct 25 16:47:45 MDT 2006


Hi

I'm curious about the question mark and the colon in the structure of  
this line:

$checked = ( eregi($value,$dJP['answer06'][0])) ? "checked=\"checked 
\"" : "";

Is it the same as saying:

if ( eregi($value,$dJP['answer06'][0]) ) {
	$checked = "checked";
} else {
	$checked = "";
}

Is this specific to regular expressions?

-Joel


On Oct 25, 2006, at 3:11 PM, Michael Layne wrote:

> Kim,
>
> This may look overkill, but cycling through values, this is how I  
> always check or uncheck checkboxes to make edits:
>
> // I look for whether the selection is in an array I posted to the  
> database when inputting for the first time and if it is, I check  
> that box:
>
> $ans06 = array ('MSWord' => 'MS Word','MSPPT' => 'MS  
> PowerPoint','MSExcel' => 'MS Excel');
>
> say hey initially checked "MSWord" and "MSExcel", those would be  
> the ones checked when editing...
>
> in FM = field=answer06, value = MSWord, MSExcel
>     $count6 = 1;
>     foreach($ans06 as $value => $label) {
>         $checked = ( eregi($value,$dJP['answer06'][0])) ? "checked= 
> \"checked\"" : "";
>         echo "<input name=\"answer06[]\" type=\"checkbox\" value= 
> \"" . $value . "\" $checked />" . $label . "\n";
>         if ($count6 == 6) {
>             echo "<br />\n";
>         }
>         $count6++;
>     }
>
> HTH
>
> Michael
>
> Kim Hawksworth wrote:
>> I can get checkboxes to work fine when I submit  a new record.  
>> However, I can’t seem to uncheck a box that’s already been checked  
>> when doing an edit.  I’m using the code from the latest edition of  
>> FX.php in 8 Hour submit to submit and display selected values.  Is  
>> there something else that needs to be done to edit checkboxes.
>>
>> --Kim
>> -- 
>> Kim David Hawksworth, R.Ph., Web Manager
>> The OSUMC Dept. of Pharmacy
>> 410 W. 10Th Ave, Room 368 Doan
>> Ph# (614) 293-3765
>> Pager# (614) 730-8143
>> Email: kim.hawksworth at osumc.edu
>>   _______________________________________________ FX.php_List  
>> mailing list FX.php_List at mail.iviking.org http://www.iviking.org/ 
>> mailman/listinfo/fx.php_list
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list