"mantrid" <ia********@virgin.netwrote in message
news:EB*****************@newsfe3-gui.ntli.net...
>
"mantrid" <ia********@virgin.netwrote in message
news:Sr*******************@newsfe2-gui.ntli.net...
>HelloIn the following snippet of code x text fields are generated. I can
include <brat the end to split them onto separate lines, but how do I
modify the code to have two text fields on each line?
for ($x = 1; $x <= $ansperquest; $x++){
echo "Type Answer ".$x ?><input name="<?php echo 'ansE'.$x; ?>"
size="30"
>type="text"><?php
}
Thanks
Ian
ok
i got it
for ($x = 1; $x <= $ansperquest; $x++){
if ($x % 2 == 0 ){
echo "Type Answer ".$x ?><input name="<?php echo 'ansE'.$x; ?>"
size="30" type="text"><br><?php
}else{
echo "Type Answer ".$x ?><input name="<?php echo 'ansE'.$x; ?>"
size="30" type="text"><?php
}
}
Or better yet, just use the modulo test for printing the <br>
<?php for ($x = 1; $x <= $ansperquest; $x++){ ?>
Type Answer <?php echo $x ?>
<input name="ansE<?php echo $x; ?>" size="30" type="text">
<?php if ($x % 2 == 0 ) echo '<br>'; ?>
<?php } ?>
--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net || Gedoon-S @ IRCnet || rot13(xv***@bhgbyrzcv.arg)