I am trying to pass a value of a variable from one php file to another but for some reason it doesn't pass anything. I would just like some hints on how i can fix this.
At the moment I am trying to pass using include. I have tried require and require_once. I have tried global variables and I have tried creating a function to inherit from but it still displays nothing.
I am only able to post the code of the first page:
<?php
/*
* Following code will get single product details
* A product is identified by product id (pid)
*/
// array for JSON response
$response = array();
// include db connect class
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new db_connect();
// check for post data
global $userNameInput;
$passInput;
if ( isset($_POST['userNameInput']) && isset($_POST['passInput'])) {
$userNameInput = $_POST['userNameInput'];
$passInput = $_POST['passInput'];
// get a product from products table
$result = mysql_query("SELECT Business_Login_Password FROM Businesses WHERE Business_Login_UserName = '".$userNameInput."' AND Business_Login_Password = '".$passInput."'");
if (isset($result))
{
echo "<head><meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=loginHome.php\"></head> ";
} else {
// failed to insert row
$response["success"] = 0;
// $response["message"] = "Oops! An error occurred.";
// echoing JSON response
}
}
?>