Helping with Confirmation Form

Hi guys, I wonder if someone can help me here about confirmation page. Basically I have 3 pages first, the main page (index.php) second the newForm.php (this form has two function create new user and modify the user) then the last one is confirmation page (confirmPage.php).

When user click a button either Create or Modify button on the newForm page, it will take them to the confirmation page so they can view all the data before proceed click to the main page.

Here is my confirm page but for some reason when I clicked button from the newForm page it will redirect me to the main page instead of going to the confirmation page first. Can someone please help me out.


require 'includes/application.php';

  if (!isset($_SESSION['mode'])) {

    // if we get to this page without $_SESSION['mode'] being defined, we're in the wrong place...
    exit("Invalid session data");
  } else if ($_SESSION['mode'] == 'Modifying') {

    // We are modfying the DB
    $modify_sql = "UPDATE `persons` SET `name` = '".$_SESSION['name']."', `surname` = '".$_SESSION['surname']."', `address` = '".$_SESSION
	['address']."', `mobile` = '".$_SESSION['mobile']."', `dept_id`= '".$_SESSION['dept']."' WHERE `id` = '".$_SESSION['id']."'";
    mysql_query($modify_sql) or die (mysql_error());    
    // Redirect to indexPage.php    
	header("Location: indexPage_i.php?id=".$_SESSION['id']."&page=modify");
  } else {

    // We are creating a new entry
    $create_sql = "INSERT INTO `persons` (`name`,`surname`,`dept_id`,`address`,`mobile`) VALUES ('".$_SESSION['name']."','".$_SESSION[
    mysql_query($create_sql) or die (mysql_error());

    // Redirect to indexPage.php   
    header("Location: indexPage_i.php?id=".mysql_insert_id()."&page=create");


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Confirmation Page</title>


<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<div align="center">
  <table width="200" border="1">
    <h1>Are You Happy With These Info?</h1>
      <th scope="row">First Name</th>
      <td><?php echo $_SESSION['name'];?> </td>
      <th scope="row">Surname</th>
      <td><?php echo $_SESSION['surname'];?></td>
      <th scope="row">Address</th>
      <td><?php echo $_SESSION['address'];?></td>
    <!--Department Modify Form-->
      <th scope="row">Department</th> 
		$data = mysql_query ("SELECT dept_name FROM dept WHERE id = '".$_SESSION['dept']."'") or die (mysql_error());
			$row_dept= mysql_fetch_array( $data );
      		$_SESSION['dept_name'] = $row_dept['dept_name'];
			echo $_SESSION['dept_name'];
	<!--End Department-->
      <th scope="row">Mobile</th>
      <td><?php echo $_SESSION['mobile'];?> </td>

	<td colspan="2" align="center"><p>
	<br/ >
	    <input type="button" value="Back" onclick="history.go(-1)" />
	    <input type="hidden" name="mode" value="<?php echo $_SESSION['mode']; ?>">
		<input type="submit" name="mode" value="<?php echo ($_SESSION['mode'] == "Creating") ? 'Create' : 'Modify'; ?>"/>

----Solved----Thanks guys…!