HTML form not submitting correctly using PHP

For 6-7 hours I've been burning my head with this problem but couldn't find the issue nor the solution.

I've been working on a multi-step registration form on my server and i have to move it to a dedicated windows server with php 5.2.17 and apache 2.2. The problem is that in this new environment it is not working as expected. The logic of my script is the following(and this is the order in my file):

  1. Create my 3 form objects (with method=post and action=the same file)
  2. Validate each form and if true put the entered data in a session and then do a header("location: {$_SERVER['PHP_SELF']}?page=the_next_step");
  3. Start displaying the page and depending on the $_REQUEST['page'], rendering the neccessary form object (if there's no value for page render form 1, if value for page=2 render form 2 and so on).

In IE for example; when I fill in the first form and submit it, it won't even get to the validation if statement.

In firefox I can go through the steps but in the address bar I can't see my query strings(page=2, page=3).

Any idea what could be the problem? Is there any setting which must be done on php/apache on the server? Is there an issue with GET or POST or submitting data? And also I see a very weird thing: the source code of my page is being rendered in <framesets>.

Running PHP 5.2.17 + Apache 2.2 Windows 2008 server

Ok, so after some more research i found out that i may have something to do with sessions. I see that in IE session is not working and is being destroyed. This is the code:

<?php 
    session_start();
    if (!isset($fv)) $fv = &$_SESSION['rgform']['page1'];
    if (!isset($fv1)) $fv1 = &$_SESSION['rgform']['page2'];
    if (!isset($fv2)) $fv2 = &$_SESSION['rgform']['page3']; 

Now I'm creating my objects

if ($form->validate()) 
{
    $_SESSION['rgform']['page1'] = $_POST;
   header("location: {$_SERVER['PHP_SELF']}?page=step2");
}

if ($form2->validate()) 
{
   $_SESSION['rgform']['page2'] = $_POST;
   header("location: {$_SERVER['PHP_SELF']}?page=step3"); 
}

if ($form3->validate()) 
{
   $_SESSION['rgform']['page3'] = $_POST;
   header("location: {$_SERVER['PHP_SELF']}?page=step4");
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<!-- load my css, js etc -->
<body>
if(!isset($_REQUEST['page']) )
{
    $form->render('custom-template.php');

}
elseif( $_REQUEST['page']== "step2" && $_SESSION['rgform']['page1']['pagename']== "part_det" ) // on each form i have an hidden input with the name "pagename" and different value
{
    $form2->render('custom-template-2.php');
}
elseif($_REQUEST['page']== "step3" && $_SESSION['rgform']['page2']['pagename']=="comp_det")
{
    $form3->render('custom-template-3.php');
}
elseif($_REQUEST['page']== "step4" && $_SESSION['rgform']['page3']['pagename']== "buss_det")
{
    echo "Thanks!!";
    session_destroy();
}
</body>
</html>

Now, as i told you i'm printing my session on the page and when i click on submit all the POST data should be written in the session but somehow that is not working on IE and that's why i can go and render form 2.

Another interesting thing is that i'm not able to see the query string in the address bar of my browser even if after form 1 is validated i do: header("location: {$_SERVER['PHP_SELF']}?page=step2"); Is this a server setup issue?

Answers


Problem solved. It seems that the DNS provider has a "cloaking" feature which is displaying the content in a frame so IE security wasn't saving session variables from a frame.


Need Your Help

Problem with jdk and eclipse

java eclipse

Let me start by saying I've been doing professional development work in C++ for about 15 years, and I've done a very small amount of Java on Linux systems. However, I seem to be doing something

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.