php - For loop with maximum text fields -
i want print text field 6 times, if of them filled loop should not continue. here's code:
<fieldset class="keywords"> <?php $fkeywords = get_the_terms($pid, 'fkeywords'); if (is_array($fkeywords)) { foreach ($fkeywords $keyword) { echo '<input type="text" name="fkeywords[]" id="'.$keyword->slug.'" value="'.$keyword->slug.'">'; } } ?> <ol> <?php ($i=0; $i<6; $i++ ){ ?> <li><input type="text" size="20" name="foodir_keywords[]" /></li> <?php } ?> </ol> </fieldset>
for html:
<input type="text" size="20" name="keywords[]" id="valuecheck" />
you can use function checking purpose:
function checkinput() { var valuecheck = document.getelementbyid('valuecheck').value; if(!valuecheck.match(/\s/)) { alert ('empty'); return false; } else { alert("filled"); return true; } }
Comments
Post a Comment