note 54521 added to function.explode
| From: | www dot AllportPC dot com at osu1 dot php dot net | Date: | Thu, 07 Jul 2005 00:34:44 +0000 |
| Subject: | note 54521 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91560@lists.php.net to get a copy of this message | ||
I was trying to make it simple for a user to enter values in 1 text field and save them in a
database and then the database convert it to a drop down. I wrote this code and it works great.
<select name="select" size="1">
<?php $body = "value1;value2;value3;value4";
$body1 = explode(";", $body);
$body1Count = count($body1)-1;
$body1Start = 0;
do {
echo '<option value="' . $body1[$body1Start] . '">' .
$body1[$body1Start] . '</option>';
$body1Start = $body1Start + 1;
} while ($body1Count >= $body1Start); ?>
</select>
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54521
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54521&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54521&report=yes
Search -- http://master.php.net/manage/user-notes.php