NathanS Posted May 30, 2007 Share Posted May 30, 2007 Hi there everyone: I have a problem and I just can't figure it out! $AVALUE will return either Yes or No based on what the customer selects in a <select> list option. I have tested that the variable outputs correctly, and it does. However, in the following script, it always says error (the else statement) rather than the first two. Any ideas? Thanks!! $AVALUE = "".$_POST["AVALUE"]."\n"; if ($AVALUE == "Yes") { echo "<BR>"; echo "<P>The valuation has now been agreed, and an email dispatched to Business Support</P>"; echo "<P><a href='panel.php'><img src='undo.png' border='0'></a><BR /><B>Back to panel</B></a></P>"; echo "<BR>"; $msg = "Registration Number: ".$_POST["REGNO"]."\n"; $msg .= "First Name: ".$_POST["FNAME"]."\n"; $msg .= "Last Name: ".$_POST["LNAME"]."\n"; $msg .= "Postcode: ".$_POST["PCODE"]. "\n"; $msg .= "Value: ".$_POST["VVALUE"]. "\n"; $recipient = "n.scott@hertsinsurance.com"; $subject = "Valuation Agreed"; $mailheaders = "From: Herts Insurance Consultants LTD <InternetQuote@hertsinsurance.com> \n"; mail($recipient, $subject, $msg, $mailheaders); } elseif ($AVALUE == "No") { echo "<BR>"; echo "You have chosen to decline the Agreed Valuation Request. Please e-mail the customer to inform them of this decision, and the appropriate reasoning behind it. This record will remain in Unactioned AV's - Please make a note of this case so as not to mistake this for a new entry. The ID Number is '$id'. "; echo "<BR>"; echo "<P><CENTER><a href='panel.php'><img src='undo.png' border='0'></a><BR /><B>Back to panel</B></a></CENTER></P>"; echo "<BR>"; } else { echo "There has been an error, $AVALUE"; } Quote Link to comment https://forums.phpfreaks.com/topic/53553-solved-php-if-statement-error/ Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 You're adding \n onto the end of the original value, so surely you need to search for "Yes\n" and "No\n". Quote Link to comment https://forums.phpfreaks.com/topic/53553-solved-php-if-statement-error/#findComment-264662 Share on other sites More sharing options...
NathanS Posted May 30, 2007 Author Share Posted May 30, 2007 Oh....my god. I deserve to be slapped.....does it show that I've had no sleep over the past few weeks? Heh, thanks for that! I'll go and remind myself how vital sleep is and what a stupid error I was just getting! Quote Link to comment https://forums.phpfreaks.com/topic/53553-solved-php-if-statement-error/#findComment-264666 Share on other sites More sharing options...
chigley Posted May 30, 2007 Share Posted May 30, 2007 Hehe, remember to click solved Quote Link to comment https://forums.phpfreaks.com/topic/53553-solved-php-if-statement-error/#findComment-264667 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.