Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I use this code when create input box for post meta box:

<input type="text" name="<?php echo $name; ?>" id="x" value="<?php echo $value; ?>" />

Now I need to handle radio box which has 2 inputs with the same name:

<input type="radio" name="option" id="option-current" value="0" />
<input type="radio" name="option" id="option-custom" value="1" />

If use echo $name; and echo $value with radio type, post meta will have 2 value for one key, that makes the radio selection lost meaning.

How to get correct result from the radio type?

share|improve this question

1 Answer 1

Radio buttons should have the same name with different values if you want to group them together. I'd call them something that isn't option and not use the ID.

http://www.w3schools.com/html/html_forms.asp

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.