Re: php form and ssi
- From: "Álvaro G. Vicario" <alvaroNOSPAMTHANKS@xxxxxxxxxxxxxx>
- Date: Thu, 27 Nov 2008 09:37:59 +0100
Henrik Carlqvist escribió:
the_page.shtml:
-8<-------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SSI test</title>
</head>
<body>
<h1>SSI test</h1>
This page contains all the goodies we want to display close to the form.<hr>
<!--#include virtual="the_form.php"-->
</body>
</html>
-8<-------------------------------------------
If I recall correctly, the "include virtual" directive in SSI generates a new request to the web server 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.
Initially, the above looks fine, but once the button in the form is
pressed we are back to the old naked php form without all the goodies that
the .shtml page could give. The reason that the contents from the .shtml
page is lost is that the form has $_SERVER["PHP_SELF"] as the action. I
would like to instead have something like $_SERVER["REQUEST_URI"] as the
action, but can't get it to work.
Perhaps this works but, of course, it has nothing to do with PHP:
<!--#include virtual="the_form.php?foo=bar"-->
You can find some documentation about SSI for further info.
Whatever, in HTML an empty action attribute defaults to current page:
<form method="post" action="">
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.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
.
- Follow-Ups:
- Re: php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- References:
- php form and ssi
- From: Henrik Carlqvist
- php form and ssi
- Prev by Date: Re: MySQL -> PHP -> MS Excel?
- Next by Date: Re: Click fraud
- Previous by thread: php form and ssi
- Next by thread: Re: php form and ssi
- Index(es):