How do I add an input type="radio" in a form?

1

How do I add an input type="radio" in a form to the result go to other pages?  And when I edit the form does the radio choice continue to be saved?

    
asked by anonymous 13.02.2015 / 19:32

1 answer

1

Something like this? But this would be in html, you would like to create a function in PHP that would mount these fields (Sorry I did not understand your proposal very well)?

<form action="#" method="POST">
    <input type="radio" name="cor" value="vermelho"  <?= isset($_POST['cor']) && $_POST['cor'] === 'vermelho'  ? 'checked' : '' ?> >Vermelho
    <input type="radio" name="cor" value="azul" <?= isset($_POST['cor']) && $_POST['cor'] === 'azul' ? 'checked' : '' ?> >Azul
    <input type="submit" value="Enviar">
</form>

Then you get back like this - > $_POST['cor'];

    
13.02.2015 / 19:36