[FX.php List] Displaying existing data in Form for radio/checkboxes (Resend)

Steve Winter steve at bluecrocodile.co.nz
Sat Sep 24 03:48:39 MDT 2005


Hey Jonathan,

You were on the right track with if statements, but they shouldn't get too
ugly, especially if you're only dealing with single possibilities like radio
buttons..

Here's an example, which assumes that the field which can contain the Yes,
No, or Maybe values is called 'eatDonuts'.

Do you eat donuts? 
<input name="eatDonuts" type="radio" id="eatDonuts" value="Yes" <?php
if($dbData['data'][$dbKey]['eatDonuts'][0] == 'Yes') echo "checked";?>/> Yes
<input name="eatDonuts" type="radio" id="eatDonuts" value="No" <?php
if($dbData['data'][$dbKey]['eatDonuts'][0] == 'No') echo "checked";?>/> No
<input name="eatDonuts" type="radio" id="eatDonuts" value="Maybe" <?php
if($dbData['data'][$dbKey]['eatDonuts'][0] == 'Maybe') echo "checked";?>/>
Maybe

Hope this helps...

Cheers
Steve
 

-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Jonathan Schwartz
Sent: Friday, 23 September 2005 8:17 a.m.
To: FX.php Discussion List
Subject: [FX.php List] Displaying existing data in Form for radio/checkboxes
(Resend)

First of all....a big thank you to the folks who have helped me get over the
initial hurdle of learning this new set of tools for web publishing with
FMP.  I've graduated from the point of having *no
idea* what was going on, to being able to now study and learn from general
PHP resources and apply that knowledge.  Thanks again.

My current challenge is to offer up radio buttons (or value list) on a form,
and have the existing value from FMP display to the end user.

Can someone show me the syntax for displaying a radio button in EDIT mode in
a form, pre-populated with a one of three choices....YES NO MAYBE....that
already exists in FMP.

I have tried if statements, and it got real ugly, real quick.

Thanks

Jonathan



-- 

Jonathan Schwartz
Schwartz & Company
817 Marin Drive
Mill Valley, CA 94941
Phone: 415-381-1852
jonathan at eschwartz.com - http://www.eschwartz.com

_______________________________________________
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