Jump to content

Archived

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

takeiteasy

Displaying Update

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]

Share this post


Link to post
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.

Share this post


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

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.