html - Auto checked radio buttons and php form processing - How to avoid blank field? -


solved: need add autocomplete="off" radio buttons.

edit: incorrect in original assessment of what's causing error. not dependent on whether or not user makes selection. it's when use chrome's autofill feature rest of form. if use autofill no value gets passed through :-/

edit2: looks it's known bug. chrome autofill unfills radio buttons http://productforums.google.com/forum/#!topic/chrome/wnbd8p6q7yq

i have form recommended postage options pre-selected using "checked":

<fieldset class="outwardpostage">  <legend>outward postage</legend>  <label for="outwardpostageeconomy">economy<br><span class="greenprice">£3.95</span></label> <input type="radio" name="outwardpostage" value="3.95" id="outwardpostageeconomy" checked>  <label for="outwardpostagestandard">standard<br><span class="greenprice">£7.95</span></label> <input name="outwardpostage" type="radio" id="outwardpostagestandard" value="7.95">  <label for="outwardpostagepremium">premium<br><span class="greenprice">£11.95</span></label> <input type="radio" name="outwardpostage" value="11.95" id="outwardpostagepremium">  <label for="outwardpostagepostyourself">i post myself using own preferred delivery service</label> <input type="radio" name="outwardpostage" value="0" id="outwardpostagepostyourself">  </fieldset> 

the problem value doesn't passed through php form processor unless user has clicked on radio button. if have left recommended option field left blank.

how can fix this?

$outwardpostage = $_post['outwardpostage']; 

can't like:

if( !isset($_post['outwardpostage']) ) { $_post['outwardpostage'] = 3.99; }

to round not picking default?


Comments