As the question, I can do that with $_SESSION
on the below code, but I would like to do that without using $_SESSION
, any suggestion ?
I am new for using oop in php.
PHP (page 1):
include './class.php';
include './next.php';
if(isset($_POST['submit'])){
$data = new myData();
$data->setTest($_POST['test']);
}
$content = '<form method="post" action="next.php">
<input type="text" name="test" id="test" value="test"/>
<input type="submit" name="submit" value="Submit"/>
</form>';
if(!empty($next)){
$content = $next;
}
echo $content;
class.php:
class myData{
function __construct($test){
***some process***
$_SESSION["test"] = $test;
}
}
next.php
$next = $_SESSION["test"];