1
How do I add an input type="radio" in a form for the result to go to other pages? And when I edit the form the radio choice is still saved?
1
How do I add an input type="radio" in a form for the result to go to other pages? And when I edit the form the radio choice is still saved?
1
Something like this, huh? However this would be in html, you would like to create a PHP function that would mount these fields (Sorry I didn’t quite understand your proposal)?
<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>
So then you recover like this -> $_POST['cor'];
is not memorizing the option when I will edit
is the button I already have
Do you want it to be already selected when the user goes back to the screen is this? Use inline if to check or not the input; or leave a checked by default;
now when you edit this always saved the red
I want it to appear that I save
Replace the $_POST['color'] variable with the desired one. I just edited an example for you.
when I leave the page and come back do not memorize. I think you have to go to msql no?
Well, you can play in the session or something depending on what you want with it... if you want it to be recorded as something standard for all users, better save in the bank then.
Browser other questions tagged php html mysql
You are not signed in. Login or sign up in order to post.
Can you explain your doubt better? You don’t understand.
– bfavaretto