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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -