user1616439
user1616439

Reputation: 3

I cannot get radio buttons to display in a form created in php

I am trying to introduce an input type="radio" into a form which I generate with php.

In HTML this displays correctly but in php it displays only the text without the circular button.

I've created a small test simulation, below, with just the minimum code necessary to show the differences.

<body>
    <form>
        <input type="radio" name="HTMLTest" value="m">Monthly</br>
        <input type="radio" name="HTMLTest" value="w">Weekly</br>
        <input type="radio" name="HTMLTest" value="d">Daily</br>
    </form>
    <?php
    echo '<form>';
    echo '<iput type="radio" name="PHPTest" value="m">Monthly</br>';
    echo '<iput type="radio" name="PHPTest" value="w">Weekly</br>';
    echo '<iput type="radio" name="PHPTest" value="d">Daily</br>';
    echo '</form>';
    ?>
</body>

The above produces something like (I could not copy and paste the actual output)

O Monthly

O Weekly

O Daily

Monthly

Weekly

Daily

I tried many slight variations to get the output right but eventually just simplified it to the essentials to show the effect as I've run out of ideas.

All other aspects of the form worked fine.

I'm not sure if this is relevant but I am testing this code in NetBeans IDE 8.1, using XAMPP v3.2.2

Upvotes: 0

Views: 28

Answers (1)

Nana Partykar
Nana Partykar

Reputation: 10548

Change echo <iput.. to echo <input

You missed n in input

Updated Code

echo '<form>';
  echo '<input type="radio" name="PHPTest" value="m">Monthly</br>';
  echo '<input type="radio" name="PHPTest" value="w">Weekly</br>';
  echo '<input type="radio" name="PHPTest" value="d">Daily</br>';
echo '</form>';

Upvotes: 1

Related Questions