GET and POST mixed up ??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ward

    GET and POST mixed up ??

    I have a form 'G' with a selectbox and an inputbox.
    The selectbox contains 20 usernames.
    The inputbox contains a date (=tot). Next to it is a button.

    The selectbox uses an onchange event to launch the function jumpoff.
    onchange="jumpo ff(this, 'gebruiker')";

    The inputbox uses an onclick event to invoke the same function.
    onclick="jumpof f(document.G.to t,'datum');"

    Inside the jumpoff function :
    If it is a date then I reorder the dateparts and assign to x.
    If it is not I simply assign the value to x.
    Notice the alert function : it proves to me that the compounded string is
    correct IN BOTH situations, ie I get both

    contractsearch. php?usr=gebruik er&geselecteerd =ADR
    as well as
    contractsearch. php?usr=datum&g eselecteerd=200 40326

    The very same string is used in a location method to call this phpscript.
    The phpscript expects the values to arrive using GET.

    Here is the problem : it only receives them when the selectbox changes.
    If the inputbox/button is used, POST variables arrive in the script.

    var_dump proves this :
    Using the selectbox, var_dump($_GET) yields as expected
    array(2) { ["usr"]=> string(9) "gebruiker" ["geselectee rd"]=> string(3)
    "ADR" }

    Using the inputbox/button, var_dump($_GET) yields
    array(2) { ["tot"]=> string(10) "26/03/2004" ["Submit"]=> string(4)
    "Zoek"}. These are POST values.

    As I said earlier the alert function gives me this:
    contractsearch. php?usr=datum&g eselecteerd=200 40326

    I have no clue.

    Thx

    Ward


    function jumpoff(obj,par am) {
    var x,y;
    if (obj.type=="sel ect-one")
    {x=obj.options[obj.selectedInd ex].value;}
    else
    {y=obj.value;
    x=y.substr(6,4) +y.substr(3,2)+ y.substr(0,2);}
    alert ('contractsearc h.php?usr='+par am+'&geselectee rd='+x);
    parent.frames['main'].location='cont ractsearch.php?
    usr='+param+'&g eselecteerd='+x ;
    }
  • Ward

    #2
    Re: GET and POST mixed up ??

    Ward <king.albert.II @for.president. com> wrote in
    news:Xns949F8BC 855064wardgermo npreverhels@195 .130.132.70:
    [color=blue]
    > I have a form 'G' with a selectbox and an inputbox.
    > The selectbox contains 20 usernames.
    > The inputbox contains a date (=tot). Next to it is a button.
    >
    > The selectbox uses an onchange event to launch the function jumpoff.
    > onchange="jumpo ff(this, 'gebruiker')";
    >
    > The inputbox uses an onclick event to invoke the same function.
    > onclick="jumpof f(document.G.to t,'datum');"
    >
    > Inside the jumpoff function :
    > If it is a date then I reorder the dateparts and assign to x.
    > If it is not I simply assign the value to x.
    > Notice the alert function : it proves to me that the compounded string
    > is correct IN BOTH situations, ie I get both
    >
    > contractsearch. php?usr=gebruik er&geselecteerd =ADR
    > as well as
    > contractsearch. php?usr=datum&g eselecteerd=200 40326
    >
    > The very same string is used in a location method to call this
    > phpscript. The phpscript expects the values to arrive using GET.
    >
    > Here is the problem : it only receives them when the selectbox
    > changes. If the inputbox/button is used, POST variables arrive in the
    > script.
    >
    > var_dump proves this :
    > Using the selectbox, var_dump($_GET) yields as expected
    > array(2) { ["usr"]=> string(9) "gebruiker" ["geselectee rd"]=>
    > string(3) "ADR" }
    >
    > Using the inputbox/button, var_dump($_GET) yields
    > array(2) { ["tot"]=> string(10) "26/03/2004" ["Submit"]=> string(4)
    > "Zoek"}. These are POST values.
    >
    > As I said earlier the alert function gives me this:
    > contractsearch. php?usr=datum&g eselecteerd=200 40326
    >
    > I have no clue.
    >
    > Thx
    >
    > Ward
    >
    >
    > function jumpoff(obj,par am) {
    > var x,y;
    > if (obj.type=="sel ect-one")
    > {x=obj.options[obj.selectedInd ex].value;}
    > else
    > {y=obj.value;
    > x=y.substr(6,4) +y.substr(3,2)+ y.substr(0,2);}
    > alert ('contractsearc h.php?usr='+par am+'&geselectee rd='+x);
    > parent.frames['main'].location='cont ractsearch.php?
    > usr='+param+'&g eselecteerd='+x ;
    > }
    >[/color]

    Still don't know what causes this, but worked around it by modifying the
    receiving script so that it anticipates POST data as well.
    Everything works now.

    The htmlform is actually quite complex, with numerous forms that use
    post, get, javascript and "absense of action" techniques to pass data to
    other scripts (or itself).


    Comment

    Working...