Your code looks like it's from 10 years ago. I suggest using updated guides to learn from. Programming (or anything in the technology niche) changes all the time. A "Learn How To Program" guide, book, blog, or tutorial older than a year is probably out of date. MySQL has been deprecated, meaning killed, a long time ago, and should not be used anymore. Use MySQLi or PDO. When handling user input, use prepared statements. If your planning on using your code live, it will get hacked by any novice hacker as it's full of SQL injections. Your using raw GET data in SQL queries. Strip slashes isn't really going to protect you. Even 10 years ago, we used mysql_real_escape_string.
That, and your doctype, makes me think your following tutorials that are really old. I am not a doctype expert, so I don't know if there is a time that XHTML 1.0 is appropriate to use over the HTML5 doctype. I only use <!doctype HTML>
. More info on HTML5: http://www.w3schools.com/html/html5_intro.asp
Your problem is you are starting the session twice. You should have received an error, so that makes me think you have error reporting off? When developing, or debugging, have error reporting set to E_ALL to show all errors. This will save you loads of time. Those errors are there for a reason, to let you know you did something wrong. I don't see it in your code, so check your php.ini file. I have seen a lot of script where they put "error_reporting(0)" to hide their errors. That is a terrible idea, and is just lazy. Handle errors properly, and you don't have to hide them.
Why are you storing everything in $_SESSION? If you have a form that a user fills out, and you need to pass that data to another page, there is $_GET and $_POST for that..
Example:
page1.php
<form action="page2.php" method="post">
<input type="text" name="name" />
<input type="submit" name="submit" value="Submit" />
</form>
page2.php
<?php
if ( isset($_POST['name']) && ! empty($_POST['name]') ) {
echo htmlspecialchars($_POST['name'], ENT_QUOTES);
}
?>
Change your error reporting level in php.ini to E_ALL.
Use start_session() only once!
That should solve your problem, and let you know of any other errors in your code. I suggest dropping MySQL and using MySQLi. Use prepared statements on the data received by the user. Use GET or POST for your form instead of storing everything into SESSION. If you MUST use session data (ie: keeping data so it isn't lost while the user browses around other pages, like a shopping cart), then you may want to create an array and store it in the session instead of a ton of session variables.
$moviedata = array( 'city' => 'Miami', 'movie' => 'Avengers', 'date' => '05/22/2015');
$_SESSION['movie_data'] = $moviedata;
If your just passing data from a form to the next page, use GET or POST not SESSION.
Hope that guides you in the right direction.