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 "Paid: name='paid' value='$row->paid'> > paid > not paid > "; > 1) You're nesting php code within html within php! 2) tags don't have a value attribute. Try: if ($paid == 'paid') { $PAID_CHK = "CHECKED"; } if ($paid == 'no') { $UNPAID_CHK = "CHECKED"; } print "Paid: paid not paid "; -- 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
Re: [PHP] dynamically fill list box
Hey Gee: On Fri, Mar 15, 2002 at 08:11:06AM +1300, gee wrote: > print "Paid: > > paid > not paid > "; I'd take a slightly different approach (wrapped for email)... paid=='paid') ? ('checked ') : ('') ); ?> /> Yes 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
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 "Paid: paid not paid "; - 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
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] dynamically fill list box
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. Update Update a members record "; include("mydb1.inc"); mysql_connect(localhost,$user,$password); $query1 = "select * from contact where id = '$id'"; $result1 = mysql_db_query('mydb',$query1); while($row = mysql_fetch_object($result1)) { print "First Name:"; print "Last Name:"; print "Address:"; print "Paid: paid not paid "; $id = $row->id; } echo ""; echo ""; ?> You left one or more fields blank."); } $query2 = "update contact set first='$first', last='$last', address='$address', paid='$paid' where id='$id'"; mysql_db_query('mydb',$query2); echo "Your record has been updated"; } mysql_close(); ?> Thank you for any help Gee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php