Posted by Kimmo Laine on 09/25/06 05:50
"mantrid" <ian.dandav@virgin.net> wrote in message
news:EBbRg.37798$G72.512@newsfe3-gui.ntli.net...
>
> "mantrid" <ian.dandav@virgin.net> wrote in message
> news:SrbRg.40250$WV2.18238@newsfe2-gui.ntli.net...
>> HelloIn the following snippet of code x text fields are generated. I can
>> include <br> at 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
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg)
Navigation:
[Reply to this message]
|