Post question

Post question

Hi,

I am creating an Intranet style site and I am coming across a problem.

the set up I am using is thus

I have an index page
on this page there is various sections which I load in using load, and store the pages in a pages directory.

This keeps the seperate sections of the front page easily editable.

<script type="text/javascript">
      $(document).ready(function() {
      // do stuff when DOM is ready
      $('#welcome').html('<p><img src="images/ajax-loader.gif" width="16" height="16" /></p>');
      $("#welcome").load("pages/welcome.php");
      $('#users').html('<p><img src="images/ajax-loader.gif" width="16" height="16" /></p>');
      $("#users").load("pages/users.php");
      $('#user_options').html('<p><img src="images/ajax-loader.gif" width="16" height="16" /></p>');
      $("#user_options").load("pages/user_options.php");
      $('#applications').html('<p><img src="images/ajax-loader.gif" width="16" height="16" /></p>');
      $("#applications").load("pages/applications.php");
      $('#center').html('<p><img src="images/ajax-loader.gif" width="20" height="20" /></p>');
      
      
      $("input[name='search']").click(function(){this.select();});
   
         $("#pop_nav a").click(function(){$("#pop").hide("slow");});   

      $("#pop").hide();
      
      <?
      if(isset($_POST['page']))
      {
      ?>
      $("#center").load("<? echo $_POST['page']; ?>", <? echo $a; ?>);
      <?
      } else {
      ?>
      $("#center").load("pages/index.php");
      <? } ?>
   });
   


as you can see $("#center") loads the index page if the $_POST['page'] is set

this seems like it is going to cause me some serious problems in later development, also if I use a form, when you hit submit it reloads the page but the page does not receive the post vars
can anybody shed some light on this style of set up or if there is a better way of doing thing. Thnaks

[edit]

Oh the $a var I used in the load data is created like this
   //collect all POST vars and store them for passing to page sections
   $s = "{ ";
   foreach ($_POST as $var => $value)
   {
      $a[] = "$var : \"$value\" ";
   }
   $s = $s.implode($a, ",")." }";


a typical form would return $a = { FirstName : "name" ,Surname : "sname" ,page : "forms/user_info.php" ,Submit : "Submit" }

I tried sending this to the load but didn't work