.I have three php pages:
page1.php page2.php page3.php
on page1.php i have this code:
<form id="try" method="post" action="page2.php">
Batch: <input id="batch" name="batch" type="text"/><br />
Dept: <input id="dept" name="dept" type="text"><br />
<input type="submit" />
</form>
on page2.php i am able to use the values inserted on page1.php by simply calling them using $_POST['batch']; and $_POST['dept'];
but what i want to do next is to pass the values of batch and dept from page2.php to page3.php. or maybe from page1.php to page2.php since i think it's just the same.
.Help pls! Thanks in adv
@kjy112 - i'm confused, since i am using
<form method="post">
should i be starting my session on page2.php by using the following:
session_start();
$_SESSION['batch'] = $_POST['batch'];
$_SESSION['dept'] = $_POST['dept'];
and then use
session_start();
$batch = $_SESSION['batch'];
to use it on page3.php?
session_start()To use cookie-based sessions, session_start() must be called before outputing anything to the browser.Basically make sure you call that before you use session and make sure it's on top of your page.