Re: php form and ssi
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Sat, 29 Nov 2008 08:17:33 -0500
Henrik Carlqvist wrote:
Henrik Carlqvist <Henrik.Carlqvist@xxxxxxxxxxxx> wrote:
Finally, the solution:
the_form.php:
-8<-------------------------------------------
<?php
/* This if and else is to pass form data from .shtml to .php */
if(isset($_POST["my_parent"]))
{
$my_parent = $_POST["my_parent"];
unset($_POST["my_parent"]);
virtual($my_parent);
return;
}
else if(!isset($my_parent))
{
$my_parent = $_SERVER["REQUEST_URI"];
}
/* Here we take care of the data from the form */
if(isset($_POST["The_Button"]))
{
printf("The button was pressed\n");
}
/* This is the form */
printf("<form method=\"post\" action=\"%s\">\n", $_SERVER["PHP_SELF"]);
printf("<input type=\"hidden\" name=\"my_parent\" value=\"%s\">\n",
$my_parent);
?>
<input type="Submit" name="The_Button" value="Press me">
</form>
-8<-------------------------------------------
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<-------------------------------------------
The above works without any endless recursion problem both when the php
file is called directly in the browser and when called from a .shtml file.
The only thing that might seem a little odd for a user is that once any
data in a form has been submitted the URL in the browser will point to the
.php file even though the contents of the .shtml file is shown. If the
visitor then would click in the browsers URL field and press enter the php
output would be shown without the .shtml contents. I don't consider that
to be a big problem.
Thanks to Alvaro who helped me find this solution and also thanks to Jerry
for sharing his experience.
regards Henrik
Bad solution. virtual() does not work on IIS servers. And there are a lot of companies using IIS.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- 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
- Re: php form and ssi
- From: "Álvaro G. Vicario"
- Re: php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- From: Henrik Carlqvist
- Re: php form and ssi
- From: Henrik Carlqvist
- php form and ssi
- Prev by Date: Re: read apache settings
- Next by Date: Re: php form and ssi
- Previous by thread: Re: php form and ssi
- Next by thread: Re: php form and ssi
- Index(es):