I have a problem with my php site. I've made a form that when submitted loads a php file on the same page. Here's my code:
index.php:
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table cellspacing="0" cellpadding="10" width="320" border="0">
<tr>
<td>
<button type="submit" id="btn" name="form_submit">Submit</button>
</td>
</tr>
</table>
</form>
<?php
if(isset($_POST['form_submit'])) {
session_start();
$_SESSION['tblno'] = "3";
}
?>
Now the problem is in my display.php file with the following codes:
<?php
session_start();
$tblno = $_SESSION['tblno'];
echo($tblno);
?>
I would expect it will output with the value of 3, which was initialized in the index.php. But what was displayed on my display.php file was 1. Any help would be much appreciated.