php - Append Incremental Number to Class in While Loop -


i have standard while loop. want append incremental number class within while loop. while loop is:

while($row = mysqli_fetch_array($newnominee)) { print "<tr><td><input type='search' class='namesearch" name='votenominee[]' placeholder='search user' value='$nomname' /></td></tr>"; } 

so when while loop runs through want class namesearch append:

namesearch_1 namesearch_2 namesearch_3 , on.. 

i've tried adding i=0; before while loop , then:

class="namesearch_'+ +'" 

and i++ after while loop isn't doing trick.

any ideas?

have on quotes around values

$i = 0; while($row = mysqli_fetch_array($newnominee)) {    echo "<tr><td><input type='search' class='namesearch_$i' name='votenominee[]' placeholder='search user' value='$nomname' /></td></tr>"; $i++; } 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -