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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.