If I pass the string trough session it perfectly works
[CODE lang="php" title="1.php"]<?php
session_start();
$_SESSION["firstname"] = "Peter";
$_SESSION["lastname"] = "Parker";
?>
[/CODE]
[CODE lang="php" title="2.php"]<?php
session_start();
echo 'Hi, ' . $_SESSION["firstname"] . ' ' . $_SESSION["lastname"];
?>
[/CODE]
But if I pass a value inserted into the form field it doesn't work.
[CODE lang="php" title="1.php"]<?php
session_start();
?>
[/CODE]
In the file 2.php I get the value NULL. Can somebody explain how to solve this issue?
[CODE lang="php" title="1.php"]<?php
session_start();
$_SESSION["firstname"] = "Peter";
$_SESSION["lastname"] = "Parker";
?>
[/CODE]
[CODE lang="php" title="2.php"]<?php
session_start();
echo 'Hi, ' . $_SESSION["firstname"] . ' ' . $_SESSION["lastname"];
?>
[/CODE]
But if I pass a value inserted into the form field it doesn't work.
[CODE lang="php" title="1.php"]<?php
session_start();
?>
[/CODE]
HTML:
<form id="auth" method="post" action="2.php">
<div id="t20_1" class="t s2_1"><div class="norm2"><input type="text" name="report_no" form="auth"/></div></div>
<div id="t21_1" class="t s6_1"><input type="submit" value="Add data" name="upload" form="auth" id="add_data">Recording level</div>
</form>
PHP:
<?php
$_SESSION['report'] = $_POST['report_no'];
?>
In the file 2.php I get the value NULL. Can somebody explain how to solve this issue?