Hello,

I have two radio buttons within an application form and the data within it has to be persistent so that if the page is submitted and form displayed, as well as all the text inputs keeping their data, it has to too.

Basically for an example I have an input field, which keeps the data on 'reload':

<input type="text" name="company_fax" id="company_fax" class="inputText" size="10" maxlength="20" value="<?=$HTTP_POST_VARS[company_fax] ?>"/>

What's the best way to do this with radio buttons?

<div class="right">
<div class="fm-optional">
Yes&nbsp;<input type="radio" name="timed_delivery" id="timed_delivery" value="Yes" />&nbsp;&nbsp;No&nbsp;<input type="radio" name="timed_delivery" id="timed_delivery" value="No" checked />		
</div>
</div>

Any ideas on this would be greatly appreciated. Thanks! 😃

    <div class="right">
    	<div class="fm-optional">
    		Yes&nbsp;<input type="radio" name="timed_delivery" id="timed_delivery" value="Yes" <?php if($_POST['timed_delivery'] === "Yes") echo " selected " ?>/>&nbsp;&nbsp;
    		No&nbsp;<input type="radio" name="timed_delivery" id="timed_delivery" value="No" <?php if($_POST['timed_delivery'] === "No") echo " selected " ?>/>
    	</div>
    </div>
    

      Thanks Dougal, that's just what I was after.

      I replaced 'selected' with 'checked' and used two equal signs.

      Thanks again.

        haha, well I didn't want to make it too easy for you. Thats what I get from writing it in 10 seconds in notepad.

        Remember to makr the thread resolved - under thread tools at the top

          Write a Reply...