1

I need one help. I need to pass some parameter to another php file and display it using PHP. I am explaining my code below.

user.php:

<?php
  $product_id=$_POST['product_id'];
?>

I need to pass this parameter ($product_id) to the following file by calling it.

saveUser.php:

<?php
  $newCustomerobj->product_id =$_REQUEST['product_id'];

  print_r($newCustomerobj);
?>

Here i need to pass the value from user.php to saveUser.php.Please help me.

1
  • if there is no navigation from user.php to saveUser.php then use session else encode the product it and through query string pass the variable. Commented Nov 23, 2016 at 9:01

2 Answers 2

1

If it need not be secure, then pass it as a query string like saveUser.php?id=product_id and access it using $_GET['id'].

Sign up to request clarification or add additional context in comments.

Comments

0

If you write a function as following

public function functionName($product_id, $variable 2,...)
{
   require_once ('saveUser.php');
}

Then usually all variable will get in saveUser.php file. I don't know if it can help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.