简体   繁体   中英

How to retain value for radio button in form when using GO back in Multiple forms?

<tr>
<td >
<input type="radio" name="radio1" value="Masseur" />MASSEUR
</td>
<td>
<input type="radio" name="radio1" value="Agent"  />AGENT
</td>
</tr>

when coming back to this page using a go back button in next page i want the radio button selected previously to be retained(checked).Since i already have the value i can't use

<input type="radio" name="radio1" value="<?php echo ?>"  />

Please try this.

<input type="radio" name="radio1"  value="Masseur" "<?php if(isset($yourValue) && $yourValue=='Masseur' && $yourValue!='AGENT'){ echo 'checked';} ?>"  />MASSEUR

<input type="radio" name="radio1" value="Agent"  "<?php if(isset($yourValue) && $yourValue=='AGENT' && $yourValue!='Masseur'){ echo 'checked';} ?>" />AGENT

It is working in my case . Please have a try on this may help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM