0

I am having trouble trying to do a if statement that checks if the bool value returned from salesforce SOAP API is true or false? when I var_dump() the variable it returns bool(true) that is because the checkbox is ticked in salesforce.

If I untick the checkbox in salesforce it will return bool(false) which is correct. my issue is using php IF statement to determine if the value is true or false.

So what I am doing is storing the value in a variable after grabbing it so from SOQL, using var_dump to see if value exists, which it does... then using the following condition, but it is not working.

<?php if (isset($_POST['id']) && $submissionStatus === false) { ?>

What i need to do is check is the variable boolean value is false, if it is... display certain content, but the value is currently true and this if statement is still working and displaying my content... if I remove the POST id value the if statement fails, so I know the submissionStatus variable is the problem.

Current var_dump($submissionStatus); when the checkbox is unchecked in salesforce. enter image description here

If its false then it should display my content so how can I check if it is false?

This is funny, so this works if i statically set a variable with a value of false, but when I store the salesforce bool value in a variable and use that it does not work...

<?php 
$status = false;
var_dump($status);
if (isset($_POST['oppId']) && $status === false) {
?>
thechrishaddad
  • 6,523
  • 7
  • 27
  • 33
  • `the value is currently true`, then the `if()` could not possibly execute the "true" branch, because `$submissionStatus === false` would fail. – Marc B Aug 11 '15 at 14:22
  • check if `is_bool($submissionStatus)` returns true. If yes, you can do `if (isset($_POST['id']) && $submissionStatus) `. Please make also sure that $_POST['id'] isset – Philipp Dahse Aug 11 '15 at 14:23
  • Neither of those worked guys, I am finding it really weird, POST['id'] is definitely set. – thechrishaddad Aug 11 '15 at 14:27
  • Can we see more of your code? `the value is currently true and this if statement is still working and displaying my content` => That can't happen. Something's wrong somewhere else. –  Aug 11 '15 at 14:30
  • I edited my question with a pic of the var_dump fyi – thechrishaddad Aug 11 '15 at 14:33
  • And it's false, not true... –  Aug 11 '15 at 14:37
  • That is because i unticked the checkbox in salesforce just before. – thechrishaddad Aug 11 '15 at 14:37
  • Please show more code then. Where is the var_dump? Try to `var_dump(isset($_POST['id']));` also. –  Aug 11 '15 at 14:38
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/86707/discussion-between-c-had1990-and-cactus). – thechrishaddad Aug 11 '15 at 14:50

0 Answers0