Forms with action GET and Stealth Mode off

From phpCMS

Jump to: navigation, search

[edit] Forms with action="get" and stealth mode = "off"

If your page does not use the Stealth Mode, i.e. you are calling your content files like this:

http://www.yourdomain.de/parser/parser.php?file=/demo/index.htm

it is possible to run into some trouble if you are working with the 'GET' Method to send form data to the server.

The parser will transform:

<form action="mypage.htm" method="get">

into:

<form action="/parser/parser.php?file=/mypage.htm" method="get">

which is correct.

But the "?file=/mypage.htm" part will be lost in the request so that the parser will be called without information about the page that is to be displayed.

Solution: To solve this, insert a simple hidden field with the name file and the value of the target content file:

<form action="/somewhere/mytargetpage.htm" method="get">
<input type="hidden" name="file" value="/somewhere/mytargetpage.htm">
</form>

(Original entry by Ignatius (de))

Diese Seite in anderen Sprachen: Deutsch

Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage

Personal tools