here is my code. actually i am displaying some data from mysql on the page and creating dynamic link.i want started a session with session_start() in the very begining of co
You need to provide a fall-back, in case the URL provided does not contain the proper variables in the $_GET
section.
You have:
if(isset($_GET['submit'])){
$_SESSION['session_usn'] = $_GET['usn'];
}
You should do something else if $_GET['submit']
isn't set:
if(isset($_GET['submit'])){
$_SESSION['session_usn'] = $_GET['usn'];
} else {
$_SESSION['session_usn'] = "unset";
// or set a warning flag like "unset"
}
You should be feeding your php file a url like:
http://yoururl.com/page1.php?usn='333'
Where 333 is the value you want to store.