Hi,

You solve the problem yourself: "the radio input does show up once one of the radios is checked". When it is unchecked is isn't set...if you need to assign it a value in any circumstances you should test it with <?php $chkbox1 = (isset($_POST["radio_test"])) ? true : false; ?> for example (of course you may omit the ternary operator...isset() will do the same).

Ashley M. Kirchner wrote:


I have this form.html:


<form method="post" action="form.php"> text input <input type="text" name="input_test"><br /> radio input1 <input type="radio" name="radio_test" value="test1" /> radio input2 <input type="radio" name="radio_test" value="test2" /> <input type="submit" value="Submit"> </form>


Then I have this script (form.php):

<?php
foreach ($_POST as $key => $val)
echo "$key = $val\n";
?>


If I simply submit the form empty, all I get back from the script is the text input $key. The radio button doesn't show up. Why is that and how can I have it show up? (the radio input does show up once one of the radios is checked, but I need it to show up when empty as well.)



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to