Re: php form and ssi



"Á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

.



Relevant Pages

  • Re: php form and ssi
    ... Normally, you would use a php file to include your phpoi files, not a shtml file. ... like I don't want the php code to output all the formatting stuff. ...
    (comp.lang.php)
  • Re: php form and ssi
    ... form variables through .shtml when the .shtml file was called from php ... .shtml that you can't do in PHP. ... technologies won't find phpoi useful is something I can't do much about. ... Just because they use flash or something else in one part of the site means your project isn't useful in other parts of the site? ...
    (comp.lang.php)
  • Re: [PHP] A question that has been bugging me..
    ... Is it possible to have variables affect the database results of an ... .php = PHP Hypertext Preprocessor ... .shtml = SSI HTML ... Or did I completely misunderstand what sessions are used for? ...
    (php.general)
  • Re: [PHP] A question that has been bugging me..
    ... .shtml = SSI HTML ... PHP processes the .php script ... Consider it as if the .shtml file is a browser on a remote ...
    (php.general)
  • Re: Securing an Email script
    ... request to our sales office. ... Since you do ZERO checking on the values it's nothing BUT security ... very powerful PHP function to validate form fields and other ...
    (comp.lang.php)