Hi there everyone,

I've found a solution that works for me for the problem I was having
earlier with splitting a string and then having populate a dropdown box.
I don't have time to add it to the page requested earlier as I am really
rushed off my feet so if the guy who requested it could do it, that
would be great :-)

Here's how I solved my problem, probably a better way, but this works.

I have the following string:

 Deluxe double 165.00 prpn<br><br>Single 128.00 prpn<br><br>Triple
229.00 prpn

And I needed to take out the <BR>'s and have each item in an array, then
populate a form pulldown field.  In short, here's the code I used in the
end - if anyone can see a better way I'll be all ears :-)  Though this
is short, sweet and does what it needs to do.

$last_minute_room_rates = str_replace("<br>", "",
$keywords = preg_split ("'prpn'", "$last_minute_room_rates");

and for the form:

                          <select name="RoomType""><?
                                                  foreach ($keywords as
$keywords) { ?>
value="<?=$keywords?>"><?=$keywords?></option><? } ?>
                          prpn </td>

As you can see, I used the common prpn (Per room per night) at the end
of each item as a reference for the new Array item.  This removed the
prpn from the dropdown but I solved that by simply hardcoding that to
the right of the dropdown box :-)


Chris Payne

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 6/5/2002

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to