You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Coexec <co...@yahoo.com> on 2002/11/20 20:39:44 UTC

mod_Perl script and SSI need advice

Hi all, I have a question about how to pass form data
with mod_perl and SSI.

I have an HTML page with a mod_perl script included. 
The script creates a form and takes its input and then
prints output based on the input (pretty basic).  I
have the form action set to the script
(action="/perl/test.cgi"), the problem is that when
the form is submitted, the only thing that gets
printed to the screen is the cgi output.  

I could have the mod_perl script process the
information and then generate a new URL and appended a
Query_string and then redirect($url1?$foo=$bar).  I am
sure that there is a better way to do this, I just
don't know what it is.

Any and all assistance is greatly appreciated.

Thanks.

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: mod_Perl script and SSI need advice

Posted by Coexec <co...@yahoo.com>.
> Coexec wrote:
> 
> > Hi all, I have a question about how to pass form
> data
> > with mod_perl and SSI.
> >
> > I have an HTML page with a mod_perl script
> included.
> > The script creates a form and takes its input and
> then
> > prints output based on the input (pretty basic). 
> I
> > have the form action set to the script
> > (action="/perl/test.cgi"), the problem is that
> when
> > the form is submitted, the only thing that gets
> > printed to the screen is the cgi output.
> >
> > I could have the mod_perl script process the
> > information and then generate a new URL and
> appended a
> > Query_string and then redirect($url1?$foo=$bar). 
> I am
> > sure that there is a better way to do this, I just
> > don't know what it is.
> 
> 
> I'm afraid I don't quite understand your description
> of the problem.  Is 
> it that the SSI is not working, or that the CGI
> isn't getting the right 
>   input, or what?  Can you show us some of the code
> from the HTML page 
> and the CGI script?  How are you running the CGI? 
> Apache::Registry?
> 
> - Perrin
> 

Here is an example of what I mean:
Here is a basic form built with cgi.pm.
Name the script "test"

print header;
if (param("foo")) {
    print start_html,
    "You Entered: ",em(param("foo")),
}

else {
    print start_html,
    start_form(-action=>"/perl/test"),
    "Enter something : ",textfield("foo"),
    submit,
    end_form,
}
print end_html;

Works with no errors under CGI and Apache::Registry
Then I would add the above script as an include in the
following page (demo.shtml):

<html>
<head>
<title>Test SSI Page</title>
</head>
<body>
<p>This is a test page</p><br>
<!--#include virtual="/perl/test" -->
</body>
</html>

So the when I access demo.shtml, I see the text from
the HTML page and also the form from the included
scipt.

When I fill out the form and hit submit, the returned
data gets printed to the screen:

"You Entered" plus whatever you entered in the form.

What I would like to do is fill out the form, submit
it, and end up back to the shtml page with the result
of the script (rather than the form) included in the
shtml.

I understand why this is happening, I am not asking
why, all I am asking is what is the preferred method
of accomplishing this.

Thanks

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: mod_Perl script and SSI need advice

Posted by Perrin Harkins <pe...@elem.com>.
Coexec wrote:

> Hi all, I have a question about how to pass form data
> with mod_perl and SSI.
>
> I have an HTML page with a mod_perl script included.
> The script creates a form and takes its input and then
> prints output based on the input (pretty basic).  I
> have the form action set to the script
> (action="/perl/test.cgi"), the problem is that when
> the form is submitted, the only thing that gets
> printed to the screen is the cgi output.
>
> I could have the mod_perl script process the
> information and then generate a new URL and appended a
> Query_string and then redirect($url1?$foo=$bar).  I am
> sure that there is a better way to do this, I just
> don't know what it is.


I'm afraid I don't quite understand your description of the problem.  Is 
it that the SSI is not working, or that the CGI isn't getting the right 
  input, or what?  Can you show us some of the code from the HTML page 
and the CGI script?  How are you running the CGI?  Apache::Registry?

- Perrin