Re: php form and ssi
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 28 Nov 2008 08:18:35 -0500
Henrik Carlqvist wrote:
"Á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.
Looks like it was added by mod_include. I haven't checked into why this might occur.
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.
That's how mod_include works - it generates another request to Apache to load the included module.
3) The .shtml file is given as the referer on the log line for the .php
file.
That is correct.
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.
Correct, because it is the .shtml file which is performing the request.
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.
Correct, because Apache doesn't think a .shtml file can process POST information.
Is it possible to pass form data to a php script through an .shtmlI can't understand why you can't simply get rid of SSI but I suppose
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.
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.
I see one file (download.shtml) which references using shtml files. And I'm not sure I agree with that. Plus, this is a new project, and hasn't had much for uses yet
Most of the time you include php files from other php files, not shtml files.
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"]\".
You need to follow up with this on the phpoi support forums. It's their scripts, they should know how to make it work.
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.
Why not? Someone has to output formatting stuff.
regards Henrik
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- References:
- php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- From: "Álvaro G. Vicario"
- Re: php form and ssi
- From: Henrik Carlqvist
- php form and ssi
- Prev by Date: Re: Documentation tool
- Next by Date: Re: Question on conditional statement
- Previous by thread: Re: php form and ssi
- Next by thread: Re: php form and ssi
- Index(es):
Relevant Pages
|