Issues with 'checked' attribute in 'input' form tags within PHP while loops -



Issues with 'checked' attribute in 'input' form tags within PHP while loops -

i'm using html form edit sql db, want have form display value in database. i'm using while loop display sql rows. simple radio button allowing user chose between 'listings' (shows '0' in sql) or 'recent transactions" (shown '1' in sql).

the radio buttons not pre-filling value sqlas checked or not

<form name="edit listing" action="edit_list.php" method="post" id="edit_form" > <ul> <?php while ($data=mysqli_fetch_assoc($result)): $transaction = $data['transaction']; $chkvalue='checked="checked"'; ?> <li> <fieldset> <legend>designation <h6>required</h6></legend> <input name="transaction" type="radio" tabindex="11" value="0" <?php if ($transaction == '0') echo $chkvalue; ?> /> <label for="listings">listings</label> <input name="transaction" type="radio" tabindex="12" value="1" <?php if ($transaction == '1') echo $chkvalue; ?> /> <label for="recent_transactions">recent transactions</label> </fieldset> <input type="submit" formaction="edit_list.php" value="submit changes" /> </form> </li> <?php endwhile;mysqli_close($con);?> </ul>

the short php insert working, little. source code looking this:

<input name="transaction" type="radio" tabindex="11" value="0" /> <label for="listings">listings</label> <input name="transaction" type="radio" tabindex="12" value="1" checked="checked" /> <label for="recent_transactions">recent transactions</label>

but radio button not pre-filling.

i've been poking @ day, suggestion here problem extremely helpful

you have write checked not check="checked"!

so alter this:

$chkvalue='checked'; ?>

instead of this:

$chkvalue='checked="checked"'; ?>

php forms input checked

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -