Re: php form and ssi
- From: Henrik Carlqvist <Henrik.Carlqvist@xxxxxxxxxxxx>
- Date: Thu, 27 Nov 2008 20:49:16 +0100
"Álvaro G. Vicario" <alvaroNOSPAMTHANKS@xxxxxxxxxxxxxx> wrote:
If I recall correctly, the "include virtual" directive in SSI generates
a new request to the web server
Thanks for your reply! Yes, that is correct, new requests are generated. I
have made an .shtml page which includes a file phpinfo.php and find the
following in the log files of apache:
"GET /~henca/test/form_test.shtml HTTP/1.1" 200 36308 "-" "Mozilla/5.0...
"GET /~henca/test/phpinfo.php?=PHPE9568F34-D428-11d2-A769-00AA001ACF42
HTTP/1.1" 200 2974 "http://localhost/~henca/test/form_test.shtml"
"Mozilla/5.0...
So first the .shtml file is loaded, then the included php file is loaded.
A few interesting things to note:
1) A string "?=PHPE95..." has been added to the php url, this was not
included in my .shtml file.
2) Even though it is the apache web server that transparently loads the
..php file the log says that it was my browser Mozilla... that requested
the file.
3) The .shtml file is given as the referer on the log line for the .php
file.
so, as far as PHP is concerned, the_form.php is an independent script
and both $_SERVER["PHP_SELF"] and $_SERVER["REQUEST_URI"] refer to it.
You could really expect that would be the case, but in my test with
phpinfo() I can see that $_SERVER["REQUEST_URI"] points to the .shtml
file.
Perhaps this works but, of course, it has nothing to do with PHP:
<!--#include virtual="the_form.php?foo=bar"-->
Yes, that would work to pass variables from .shtml to .php. Unfortunately
it would hardcode the variable names as well as their values so this
solution wouldn't be usable to pass any data given by a user in a form.
Whatever, in HTML an empty action attribute defaults to current page:
<form method="post" action="">
Thanks for the tip. Unfortunately with action="" I get the same result as
with action=\"$_SERVER["REQUEST_URI"]\", that is I get an error message
saying:
405 Method Not Allowed
The requested method POST is not allowed for the URL /form_test.shtml.
Is it possible to pass form data to a php script through an .shtml
file? I would prefer a solution where the .shtml file doesn't need to
have any knowledge about the data it passes to the php file.
I can't understand why you can't simply get rid of SSI but I suppose
you'll have your reasons.
In my case my reason is phpoi, available at http://phpoi.sourceforge.net/
.. Phpoi consists of a number of php scripts. Their html output doesn't
look much to the world, but the php scripts are meant to be used by
different people who can include them from .shtml pages with other
contents and designs.
Today it all works great except for the administration php scripts which
uses forms and once the forms are used they have to escape from any
..shtml-page with an action=\"$_SERVER["PHP_SELF"]\".
However, now I would like to also add forms to the pages used by normal
users. As I don't know who will use phpoi and what
their pages look like I don't want the php code to output all the
formatting stuff.
regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost
.
- Follow-Ups:
- Re: php form and ssi
- From: Jerry Stuckle
- Re: php form and ssi
- From: "Álvaro G. Vicario"
- Re: php form and ssi
- References:
- php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- From: "Álvaro G. Vicario"
- php form and ssi
- Prev by Date: Re: Get result from Google search
- Next by Date: URL parsing, help
- Previous by thread: Re: php form and ssi
- Next by thread: Re: php form and ssi
- Index(es):
Relevant Pages
|