By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,978 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,978 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 <selecttag 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.

May 6 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On May 6, 6:42 pm, ryn...@gmail.com wrote:
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 <selecttag 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.
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.

May 6 '07 #2

P: n/a
Check your variable hierarchy. You can reset it for the page.

<ry****@gmail.comwrote in message
news:11*********************@n59g2000hsh.googlegro ups.com...
>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 <selecttag 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.

May 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.