POST-ed XAMPP localhosted üzerinde sıfırlama değil vars

0 Cevap php

[edit] Just a though: could that be due to php version differences? 5.2.1 works anything above does not ... I know ... sounds silly, but this problem - however not "life-n-death", I've got good server for development ... bugs me ... I must say.[end edit]

Just a thought Before placing this post I've read some few dozens of POST related problems here, but I was not able to find anything similar.

System description:
1. system has one page only: index.php
2. required task code is being loaded as modules into that index.php (require/include), as and when needed
3. "actions" are located in head of index (above "!doctype html..") instead of being stored in separate file and also are being called as and when needed by require/include.

Tested with cases:
1. Centos 2.6 (not exactly sure here), Apache 2, PHP 5.2.10, www host - works fine
2. XAMPP 1.6.8a on ubuntu 10.10: Apache 2.2, PHP 5.2.6, localhost - problem exists
3. XAMPP 1.7.3 on ubuntu 10.10: Apache 2.2, PHP 5.3.1, localhost - problem exists
4. XAMPP 1.7.3 on Vista64: Apache 2.2, PHP 5.3.1, localhost - problem exists

Problem description:
1. POSTed vars are being sent to "action" (see:#3 above).
2. "Action" satisfactorily performs its task same way in all "Tested with cases".
3. Then at the end of action header('Location: ' . $url) is used to redirect to index.php with a proper set of GET vars to fetch and display proper module.
4. Case#1: executes redirect properly and as well looses used POST variables (as expected - which is a proper handling of POSTed vars)
5. CASE#2, Case#3 and Case#4 (localhosted): execute redirect properly, but all cases fail to loose POSTed vars sent to action (which I believe they should).

Do I understand, that C2, C3 and C4 are not performing properly, or my understanding of this process is flawed?


Much appreciated, if someone shares his/her experience in that matter, if you came across it as well.

BTW: localhosted XAMPP has a lot more "peculiarities", like handling cookies (expiry time/cookie domain must be false or it will not work) - and there are more.

Please post your "localhosted discoveries" here as well - so it may help someone.

gövde:

    <form name="order_search" action="http://www.someurl.com" method="post">
    <input type="hidden" name="action" value="do_something">
    <input type="text" name="post_var1" value="some_numeric_value" size="9">
    <input type="hidden" name="post_var2" value="some_serialized_not_too_long_array">
    <input type="submit" alt="Submit" value="Submit" border="0">
    </form>

hareket:

  $action = (isset($action) ? $action : '');
  if (!empty($action)) {
    switch ($action) {

      case 'do_something':
        $var1 = $post_var1;
        $var2 = $post_var2;

        //do something here: all cases do it right

        $url = 'http://www.someurl.com?var1='.$var1.'&var2='.$var2;
        header('Location: ' . $url) 
        break;
    }
  }

0 Cevap