i have stored the value of check box as 0 or 1
0 for off and 1 for on
plz tell me how to retrive that value again in checkboxes
hello mohsin1122,
suppose $result is an array containing complite detail of record and ‘chkboxval’ is filed in databsae table store checkbox value define as integer in tabele either 0 or 1.
<input type="checkbox" value="1" checked="checked" name="chkboxval" />
<? } else { ?>
<input type="checkbox" value="0" name="chkboxval" />
<? } ?>
SR
i got error in Integrating your code
plz help me
[php]
include(“includes/dbcon.php”);
$result = mysql_query(“SELECT * FROM payment methods
order by PaymentMethodID ASC”);
$no_record = mysql_num_rows($result);
if($no_record > 0)
{
?>
Payment ID | Payment Method | Credit Card | Edit | Delete | <?php while($row = mysql_fetch_array($result)) { //$cc = $row['CreditCard']=='1'; // if($cc=='1'){echo "checked=\"checked\"";} echo '
---|---|---|---|---|
'.$row['PaymentMethodID'].' | '.$row['PaymentMethod'].' | '.[b]if($row['CreditCard']=='1'){""[/b]}.' | ='.'Edit'.' | '.'Delete'.' |
hello mohsin1122,
i have modify your code as per requirement. Try below code this will work for you.
[php]
<table width="90%" align="center" border="1">
<tr>
<th width="10%" bgcolor="orange">Payment ID</th>
<th width="15%" bgcolor="orange">Payment Method</th>
<th width="10%" bgcolor="orange">Credit Card</th>
<th width="7%" bgcolor="orange">Edit</th>
<th width="7%" bgcolor="orange">Delete</th>
<?php
while($row = mysql_fetch_array($result))
{
echo 'Thank You so much Mr.Sarthak Patel
u r genious
hello mohsin1122,
thanks and post more issues if you have. i am always here for your help.
Have a nice day!!! ;D
SR