The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.17 (Linux)
|
![]() |
Radio displaying checked rather than showing radio selected state? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17) +--- Thread: Radio displaying checked rather than showing radio selected state? (/showthread.php?tid=2038) |
Radio displaying checked rather than showing radio selected state? - Kev - Jun 28th, 2012 Hello, New to Form Tools and working through tuts for a questionnaire. All is good appart from: if the form fails validation the word "checked" is displayed next to the selected radio button instead of showing a selected radio button? This an extract from the code: td>It was easy to contact my local depot</td> <td align="center"><input name="q2a" type="radio" value="6"><?php if (@$fields["q2a"] == "6") echo "checked"; ?></td> <td align="center"><input name="q2a" type="radio" value="5"><?php if (@$fields["q2a"] == "5") echo "checked"; ?></td> <td align="center"><input name="q2a" type="radio" value="4"><?php if (@$fields["q2a"] == "4") echo "checked"; ?></td> <td align="center"><input name="q2a" type="radio" value="3"><?php if (@$fields["q2a"] == "3") echo "checked"; ?></td> <td align="center"><input name="q2a" type="radio" value="2"><?php if (@$fields["q2a"] == "2") echo "checked"; ?></td> <td align="center"><input name="q2a" type="radio" value="1"><?php if (@$fields["q2a"] == "1") echo "checked"; ?></td> My form action is: <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> Params: <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST"> Demo url http://bit.ly/MVpwjt RE: Radio displaying checked rather than showing radio selected state? - Kev - Jun 29th, 2012 (Jun 28th, 2012, 4:42 AM)Kev Wrote: Hello, OK Found it.. I needed to remove the closing > after value: <td align="center"><input name="q2a" type="radio" value="6"><?php if (@$fields["q2a"] == "6") echo "checked"; ?></td> And pace it at the end: td align="center"><input name="q2a" type="radio" value="6" <?php if (@$fields["q2a"] == "6") echo "checked"; ?> /></td> Problem solved.. |