Acces link if it is returned True

Discuss coding issues, and scripts related to PHP and MySQL.
mluci12
Posts:39

Acces link if it is returned True

Hello!
I have a linux server with custom api.I make a php script who check if user pay invoce.How can i make this script acces a link if he return true.The link is like: "ipservert:2030/username=../planname=.."

Admin Posts:805
Hi
If you want to open /redirect to a page address when a condition is True in php, you can use the header() function; like in this example:

Code: Select all

$some_var =true;
if(isset($some_var) && $some_var ===true){
  header('Location: //ipservert:2030/username=../planname=..');
  exit();
}
else echo 'Error some text..';
Or, if you want to display a link:

Code: Select all

$some_var =true;
if(isset($some_var) && $some_var ===true){
  echo '<br><a href="//ipservert:2030/username=../planname=.." title="Click">Click</a>';
}
else echo 'Error some text..';