-1

I have the following post from my form in Angular:

$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
@$id = $request->id;
@$cid = $request->cid;
@$description = $request->description;
@$type = $request->type;
@$owner = $request->owner;
@$ssamount = $request->ssamount; 
if($owner == 'spouse' && $type == 'ira')
{$exempt == 'yes'};
if(mysqli_connect_errno()) { Etc...

What I am trying to accomplish is to place some logic in PHP as opposed to client side. If the two variables from the Angular JSON posted file match a criteria as shown, I want another field in the MYSQL database to be set to yes or no. $exempt in the above.

I get no errors but it does not change the field in MYSQL. I think the problem might be related to the structure of the decoded JSON or that I might have to add this JSON object to $postdata before decoding it.

Any ideas? Thank you

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Lawyer_Coder
  • 203
  • 1
  • 3
  • 14

1 Answers1

0

Specifically in your code you should replace:

if($owner == 'spouse' && $type == 'ira')
{$exempt == 'yes'};

with

if($owner == 'spouse' && $type == 'ira') {
    $exempt = 'yes';
}

The double equal sign is a comparison operator while a single equal sign is an assignment operator.

Andrew Shell
  • 810
  • 1
  • 8
  • 15