|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
multiple select box values
I have a multiple select box with contact names and phone numbers. When you select a name that has "Investors" in front of it, I want it to display all the Names and phone numbers, but only show the word Investors once. For example, I want it to look like this:
Invesors: Name Phone Number, Name2, Phone Number 2 Here is the code I am using to seperate the value by a comma: <? foreach($contacts as $value) { list ($id, $info) = split (",", $value); echo "<input type=hidden name=contacts[] value=$id,$info>\n"; }?> Then here is the code I am using to display the data: <? echo "Contacts:"; foreach($contacts as $value) { list ($id, $info) = split (",", $value); $info = str_replace("~", " ", $info); $inv = substr("$info", 0, 9); //while ($inv == "Investors") { // echo "<p>" . $info . ", "; //} if ($inv == "Investors") { echo "<p>" . $info . " or <a href=mailto:investor@riteaid.com>investor@riteaid.com</a></p>"; } else { echo "<p>" . $info . "</p>"; } } ?> But this gives me the following result: Investors: Name Phone Number Investors: Name2 Phone Number Any help would be greatly appreciated |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|