Re: [PHP] dynamically fill list box
On Thursday 14 March 2002 16:07, gee wrote: A real newbie would be grateful for some help. I have a sports club membership database (Mysql) with first and last names, address and paid or not paid. In edit.php I would like to be able to pre-fill a list box with whether the person has paid or not, change if necessary, update the database and view the resultant changes in members.php I have tried the following in edit.php but can't get it to work. By stating *how* it doesn't work makes it easier for others to help you. For starters, do you get any errors? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I hope you millionaires are having fun! I just invested half your life savings in yeast!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically fill list box
Sorry... The error I get on members.php page is if ( == paid) is printed if 'paid' is selected or if ($paid == no) is printed if 'not paid' is selected from this piece of code print trtd class=LabelColumnPaid:/tdtd class=TextColumnselect name='paid' value='$row-paid' option value='if ($paid == paid)'paid/option option value='if ($paid == no)'not paid/option /select/td/tr; - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 14, 2002 9:36 PM Subject: Re: [PHP] dynamically fill list box On Thursday 14 March 2002 16:07, gee wrote: A real newbie would be grateful for some help. I have a sports club membership database (Mysql) with first and last names, address and paid or not paid. In edit.php I would like to be able to pre-fill a list box with whether the person has paid or not, change if necessary, update the database and view the resultant changes in members.php I have tried the following in edit.php but can't get it to work. By stating *how* it doesn't work makes it easier for others to help you. For starters, do you get any errors? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* I hope you millionaires are having fun! I just invested half your life savings in yeast!! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically fill list box
Hey Gee: On Fri, Mar 15, 2002 at 08:11:06AM +1300, gee wrote: print trtd class=LabelColumnPaid:/tdtd class=TextColumn select name='paid' value='$row-paid' option value='if ($paid == paid)'paid/option option value='if ($paid == no)'not paid/option /select/td/tr; I'd take a slightly different approach (wrapped for email)... input type=radio name=paid value=paid ?php echo ( ($row-paid=='paid') ? ('checked ') : ('') ); ? / Yes input type=radio name=paid value=no ?php echo ( ($row-paid!='paid') ? ('checked ') : ('') ); ? / No 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically fill list box
On Friday 15 March 2002 03:11, you wrote: Sorry... The error I get on members.php page is if ( == paid) is printed if 'paid' is selected or if ($paid == no) is printed if 'not paid' is selected from this piece of code print trtd class=LabelColumnPaid:/tdtd class=TextColumnselect name='paid' value='$row-paid' option value='if ($paid == paid)'paid/option option value='if ($paid == no)'not paid/option /select/td/tr; 1) You're nesting php code within html within php! 2) select tags don't have a value attribute. Try: if ($paid == 'paid') { $PAID_CHK = CHECKED; } if ($paid == 'no') { $UNPAID_CHK = CHECKED; } print trtd class=LabelColumnPaid:/tdtd class=TextColumnselect name='paid' option value='paid' $PAID_CHKpaid/option option value='no' $UNPAID_CHKnot paid/option /select/td/tr; -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Nothing will dispel enthusiasm like a small admission fee. -- Kim Hubbard */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php