Jump to content

Displaying Update


takeiteasy

Recommended Posts

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
[code]
<input type='radio'  name='paymentMode' value='Cash'>Cash       <input type='radio' name ='paymentMode' value='CreditCard'>Credit Card    <input type='radio' name ='paymentMode' value='Cheque'>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/9288-displaying-update/
Share on other sites

If $row['payment'] holds said value, something like....
[code]
<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'>
[/code]
should do it.
Link to comment
https://forums.phpfreaks.com/topic/9288-displaying-update/#findComment-34226
Share on other sites

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

[code]
<?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
[/code]
Link to comment
https://forums.phpfreaks.com/topic/9288-displaying-update/#findComment-34549
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.