-1
How do I leave the radiobutton "checked" in PHP ? I’m having trouble with that the name of the radiobutton is sex and I need to do a check in the database if the sex is’M' it marks one of the sex radiobutton otherwise it marks the other sex radiobutton. I’ve done SELECT and it returned the value of the other variables normally, I just want to know how to mark a radiobutton, my code is wrong ? I have checked if the variable is receiving the sex value correctly and is, the condition code is after the creation of the radiobutton, I can not think of anything that is wrong, can only be the way I am marking the radiobutton.
<label>Sexo:</label><input type="radio" name="sexo" value="M"/>
<label>Masculino</label>
<input type="radio" name="sexo" value="F"/>
<label>Feminino</label>
if($vsexo == 'M')
{
echo "<script type='text/javascript'>sexo[0].checked = true;</script>";
}
else
{
echo "<script type='text/javascript'>sexo[1].checked = true;</script>";
}
what is "trust"?
– ShutUpMagda
Checked ? dial the radiobutton
– Caio Vieira
Ah... condition... When loading the document you want it to be marked according to the information received from the database, right?
– ShutUpMagda
That’s right .!.
– Caio Vieira
You know what to do to score ?
– Caio Vieira