How can a form set to 'get' return 'post'????

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a form which the user fills out to enter some data.

If there already exists an uncompleted session - say, the user started
entering some data but had to stop to do something else - the user has
the option of selecting that session from a drop-down menu (think
<form><select><option>....</option></select></form>). The method for
that particular form is set to 'GET' and the action is
$_SERVER['PHP_SELF']. The <select> tag has a bit of javascript
(onChange) which, when the session is chosen, triggers a 'submit' of
the uncompleted session's session ID number.

So the user selects the uncompleted session, the session ID is looked
up, the data retrieved, and the page reloads and shows the data which
they (or someone else) already entered, retrieved from a mySQL table
(using the session ID) designated to temporarily store data from
uncompleted sessions until it is ready to be written to the
'permanent' tables. At this point the user should update any
information if so desired, then click on "Submit" at the bottom of the
page to update the table and go on to the next page of the form. This
causes the same page to reload, validation is run, and if it passes it
again reloads the page only this time it sets a flag to write a <meta>
redirect tag to the page. The page is reloaded but instantly
redirected to the next page (I couldn't use "header()" because the
headers are already written).

The validation script is part of the same document. There is an IF
statement at the head of the validation portion - if
($_SERVER['REQUEST_METHOD'] == 'POST'). This should, in theory,
prevent the script from running a retrieved 'open session' through the
validation, at the end of which if everything passes validation the
data for that session is updated (or if it is a new
session ,inserted). It should only be invoked if someone presses the
"Submit" button at the bottom of the page, which is set to "POST". So
in theory, the validation should only be run when "submit" is clicked
by the user, not when an open session is selected and "submit" is sent
by the 'onChange' javascript.

What's going screwy is that the open session's request method is
coming back as "POST" even though it is explicitly set as "GET". So
when an open session is retrieved, the page reloads, the validation is
run, everything checks out so the data is updated and the browser
loads the next page, without the user getting the opportunity to
update any of the retrieved open session's data.

I hope I have explained this clearly. Can someone tell me why the
first submit - the one for the drop-down menu of open sessions - is
returning POST even though it is set to GET? This is screwing
everything up and I can't figure a way around it.

Re: How can a form set to 'get' return 'post'????

On May 6, 6:42 pm, wrote:
Quoted text here. Click to load it

sounds liek the javascript attached to the onchange is setting the
forms method to post. Unless post is in the actual markup in which
case your statement that it is set to GET is not true, I assume youve
looked and know youre right, so the only other option is that the
javascript changes it prior to submitting the selected session.

Re: How can a form set to 'get' return 'post'????

Check your variable hierarchy.  You can reset it for the page.

Quoted text here. Click to load it

Site Timeline