Irishjugg
12-08-2008, 02:47 AM
Hey all,
sort of new to php, but I am a c++ etc coder so I know general coding practice.
If there a way for me to have a dynamic number of text inputs on a php page in a form, which I am naming foo$ct where $ct is postincremented in my while loop. Can I on the action= page load those variables as $foo$c where $c is a for loop on 0 -> $ct?
Or should I just be storing everything with an array?
Some code:
while($row = mysql_fetch_array($result)) {
?>
<tr>
<td>
<?php
$sht = trim($row['shortannounce']);
print "<input type=\"hidden\" name=\"key$ct\" value=\"$sht\" />";
print "<textarea rows=\"4\" cols=\"40\" class=\"small\" name=\"stannounce$ct\">".$sht;
?>
theres a $ct++; at the end of the while loop.
How should I better handle this issue of dynamicly named inputs for the action page?
sort of new to php, but I am a c++ etc coder so I know general coding practice.
If there a way for me to have a dynamic number of text inputs on a php page in a form, which I am naming foo$ct where $ct is postincremented in my while loop. Can I on the action= page load those variables as $foo$c where $c is a for loop on 0 -> $ct?
Or should I just be storing everything with an array?
Some code:
while($row = mysql_fetch_array($result)) {
?>
<tr>
<td>
<?php
$sht = trim($row['shortannounce']);
print "<input type=\"hidden\" name=\"key$ct\" value=\"$sht\" />";
print "<textarea rows=\"4\" cols=\"40\" class=\"small\" name=\"stannounce$ct\">".$sht;
?>
theres a $ct++; at the end of the while loop.
How should I better handle this issue of dynamicly named inputs for the action page?