Jump to content


Photo

Displaying Update


  • Please log in to reply
3 replies to this topic

#1 takeiteasy

takeiteasy
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 08 May 2006 - 04:46 AM

In my Add form, i have radio buttons for payment mode consisting of Cash, Credit Card and Cheque. If i select the radio button for Cash, MySQL will add the record as 'Cash' right....but wad if i wan to display the stored record in my Edit form in radio button Cash, Credit Card. Cheque, checked Cash? how do i go about the code?TIA!

This is my code in Add form
<input type='radio'  name='paymentMode' value='Cash'>Cash       <input type='radio' name ='paymentMode' value='CreditCard'>Credit Card    <input type='radio' name ='paymentMode' value='Cheque'>


#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 08 May 2006 - 05:08 AM

If $row['payment'] holds said value, something like....
<input type='radio'<?php ($row['payment'] == 'Cash') ? echo 'checked="checked" : echo ''; ?> name='paymentMode' value='Cash'>Cash
<input type='radio'<?php ($row['payment'] == 'Credit') ? echo 'checked="checked" : echo ''; ?> name ='paymentMode' value='CreditCard'>Credit Card
<input type='radio'<?php ($row['payment'] == 'Cheque') ? echo 'checked="checked" : echo ''; ?> name ='paymentMode' value='Cheque'>
should do it.

#3 takeiteasy

takeiteasy
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 08 May 2006 - 05:37 AM

i've tried your solution but it still can't work. The radio buttons are still not checked. Any other soultions? Thanks!

#4 takeiteasy

takeiteasy
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 09 May 2006 - 09:50 AM

I have tried this but still not working...can someone help?

<?php  
$ca = $nets = $cc = ''; ?> 

<?php 
if ($paymentMode == 'Cash') { 
$ca = ' checked'; 
} else if ($paymentMode == 'Nets') { 
$nets = 'checked'; 
} else { 
$cc = 'checked'; 
} 
} 


?> 

<input type='radio'  name='paymentMode' value='Cash' echo $ca;>Cash       <input type='radio' name ='paymentMode' value='Nets' echo $nets;>Nets   <input type='radio' name ='paymentMode' value='Cheque' echo $cc;>Cheque 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users