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

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -