note 54521 deleted from function.explode by bjori
| From: | bjori@php.net | Date: | Mon, 25 Sep 2006 08:09:03 +0000 |
| Subject: | note 54521 deleted from function.explode by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117582@lists.php.net to get a copy of this message | ||
Note Submitter: www.AllportPC.com
----
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>