forum_amnesiac posted some code in another thread which is very similar to mine but I started a new thread as to not interfere with the other thread question.
This also creates a dynamic dropdown list
Function for selectPHP Code:$carriers = array(
'Alltel' => '@message.alltel.com',
'Ameritech' => '@paging.acswireless.com',
'AT&T' => '@txt.att.net',
'Bellsouth' => '@sms.bellsouth.com',
);
After submit I use the following vars to echo out who the message was sent to.PHP Code:function carrierOptions($selected)
{
$html = '';
global $carriers;
foreach($carriers as $carrier => $email)
{
if($selected==$carrier) { $html .= '<option value="'.$carrier.'" SELECTED>'.$carrier.'</option>'; }
else { $html .= '<option value="'.$carrier.'">'.$carrier.'</option>'; }
}
return $html;
}
$to would produce something like xxxxxxxxxx @ message.alltel.com (spaces to not create a link)PHP Code:$carrier = $carriers[$carrier];
$to = $phone.$carrier;
Everything works fine
but I would like to show the selected value from the dropdown also
With this array type I don't believe there is a way to show the carrier name that way since the array associates to the provider email address like => $emailPHP Code:echo "Carrier selected was: ".$name_var." and your message was sent to ".$to."";
//Carrier selected was: Alltel and and your message was sent to xxxxxxxxxx@message.alltel.com
Could the above function be re-written maybe to dynamically just provide the Carrier name that was selected? I appreciate any help, thank you.



Reply With Quote
Bookmarks