This is for an online form for product returns. The user selects from a menu, Refund, Replacement, 90DaysExpired, etc… (choices shown below). Each of those choices, has a corresponding message(inside a variable, also shown below). I want the value of the variable($tbrefund, $tbreplace, etc), based on the choice of the user, to be passed to the variable ‘$message’.
This is what I have so far, and I get the following error:
Notice: Undefined variable: message
$Rarray = array(
"Refund" => "$tbrefund",
"Replacement" => "$tbreplace",
"90DaysExpired" => "$expiredwarranty",
"ContactTech" => "$contacttech",
"RefundExpiredReplace" => "$outsiderefund",
"NoExRefund" => "$noexchange",
"ManuWarranty" => "$manuwarranty",
);
if (isset($Rarray[$Request]))
$message = $Rarray[$Request];
Any help is greatly appreciated.
edit:
this is the line producing the error, I already know it’s not relevent…
$send_contact=mail($to,$subject,$message,$header);
Why would you downvote someone asking for help? It will only make new people reluctant to ask anything…
The error is because $Request is not set correctly.
So your actual question is “why is $Request not working”?
The answer is it depends on where $Request is coming from, so you need to show us some examples of $Request echoed (or var_dump() ) – but I would hazard a guess that you are sending the $Request lowercase (if it is via a URL or something) – but your array is capitalised.
Edit: and I hope you are not expecting your messages to be something other than “$tbreplace” or something.
I guessing you meant to do something like this?