How to use array as a selective menu in mail line
I cannot figure out why my array is not working, I have $carrier coming from a text document.The user selects thier carrier, and it is stored in registry.txt. I open it back up, and mail "$number" followed by each carrier's specific address, for example verizon's would be "vtext.com" I would like the array to look at $carrier, and then assign a value. For example, if $carrier = "verizon" , vtext.com. Then, I have the array linked to the mail statement as $number . "@" . $company
$text = fopen("../data/textmembers/registry.txt","r") or die("couldent open file");
while (!feof($text)) {
$name = fgets($text);
$number = fgets($text);
$carrier = fgets($text);
$date = fgets($text);
$line = fgets($text);开发者_运维问答
$message .= $content;
$message .= "\n";
$number = trim($number);
$company = array(
"Verizon" => "vtext.com",
"AT&T" => "txt.att.net",
"T-mobile" => "tmomail.net",
"Sprint" => "messaging.nextel.com"
);
$company [$carrier];
mail($number . "@" . $company, "SGA Event Alert", $message, "SGA");
Header("Location: mailconf.php");
}
Thanks a lot for the help!
You just need to choose the right company.
mail($number . "@" . $company[$carrier], "SGA Event" ...);
Also, don't forget to call die()
after header()
精彩评论