Problem with IF statement (PHP)

Associate
Joined
2 Aug 2005
Posts
680
I'm making an application form where one of the questions is "approve application?" and there is a radio box where one sets the answer to "yes" and the other "no". For some reason I can't apply the logic to the confirmation email.
Here's the code for the question in the form:

Code:
<li class="appform">Approve application  in accordence with the above details? <br />
      Yes
      <input name="agree" type="radio" value="yes" /> 
      No 
      <input name="agree" type="radio" value="no" />
    </li>

And here's part of the php code:
Code:
if ($agree = yes) { $approve = "approved" && $messageend = 'Please note your diary but await final confirmation.';}
elseif ($agree = no) { $approve = "rejected" && $messageend = 'Please contact your manager for details.';};
It's probably something stupid :p I've also tried it with $_post['agree'].
The code to change the text in the email reads:
Code:
$subjectapp = "Application " . $approve;
and it comes up with "Application 1", how can I stop it doing this?

Thanks a lot!
Dan
 
I see :D Thanks mate. I think I remember that, but I just need to remember that = in PHP isn't the same as in the real world :) It's still coming up with "Application 1" for some reason. The other text $messageend is working however. I've also tried
Code:
$subjectapp = "Application $approve";
 
Just sorted it, the two statements in the IF statement shouldn't be seperated by && so I change it to ; and it's working fine. Thanks for your help Dj :D
 
Thanks guys, I'll change it to else, sounds like the safest option. I could use the elseif then else as you mentioned above, but it's a radiobox so there are only two possible answers. Thanks again :)
Dan
 
Back
Top Bottom