RE: [PHP] adding a <br> tag in the middle of a loop
| From: | Hoover, Josh | Date: | Wed, 18 Oct 2000 21:31:57 +0000 |
| Subject: | RE: [PHP] adding a <br> tag in the middle of a loop | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-20989@lists.php.net to get a copy of this message | ||
Try this code:
<?php
$r = 0;
for ($i = 0; $i < $number; $i++)
{
echo "<input type=\"text\" name=\"variable[]\"
size=\"15\">";
if($r > 2)
{
echo "<BR>";
$r = 0;
}
else
$r++;
}
?>
That should put a break after every third input tag for you.
Josh Hoover
-----Original Message-----
From: Rodney Davis [mailto:rodney@wincubic.com]
Sent: Wednesday, October 18, 2000 5:13 PM
To: php-general@lists.php.net
Subject: [PHP] adding a <br> tag in the middle of a loop
I am trying to output a given number of <input> tags
based on a variable with the following code:
<?php
for ($i = 0; $i < $number; $i++)
{
echo "<input type=\"text\" name=\"variable[]\"
size=\"15\">";
}
?>
But, if $number is a large number I get a huge string of
<input> tages. I would like to break these every three
iterations but I have no idea how to do this. Does
anyone know how to do this?