Sponsored Content
Top Forums Web Development include virtual perl-script - submit button opens a new page.. Post 302446369 by tip78 on Wednesday 18th of August 2010 11:39:28 AM
Old 08-18-2010
include virtual perl-script - submit button opens a new page..

hello 2 all
I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not

doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"-->
filename is a name of the file which script is using
the script is used for a score show (the number is inside file "filename") + 2 buttons: + and -
when pressing a button it opens a file and changing value to +1 or -1 and instantly showing this number

the form itself:
<form method=post>
<input type=submit name=\"filename\" value=yes class=yes>
<div class=\"votes\">$curscore</div>
<input type=submit name=\"filename\" value=no class=no>
</form>

so, if I'm executing the script in a browser and not through "include virtual" then it works pretty fine just like intended but if through include virtual then when pressing any of submit buttons the page is reloading but file keeps untouched..

I've tryed to put 'action="/cgi-bin/script.cgi"' inside form, but then when pressing submit it will change to a new window just like if I would execute script inside browser itself

so what is the right way to insert script inside shtml so it will works fine just like inside browser?

P.S. btw if I use 'exec cgi' then it works but without ?filename
with ?filename it shows error: invalid CGI ref..
tip78
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl and refresh button, save twice?

Hi guys, I am writing a simple script save_me.cgi that can save the data in form.html into a txt (data.txt)file. But when user click "refresh" button one the browser on page save_me.cgi, the data will be save again in the data.txt. could someone help me on this issue? a studpid way... (3 Replies)
Discussion started by: gusla
3 Replies

2. UNIX for Dummies Questions & Answers

Script for using the Back button and the Close button

Here's a question I have for anyone that might be able to help me: I can write a html script that will allow the user to return to the previous page using the back button, and I can write a script that will allow the user to return to the previous page using the close button, but...is there a... (1 Reply)
Discussion started by: mdgibson
1 Replies

3. UNIX for Dummies Questions & Answers

Include PERL script with in the unix shell script

Hi Gurus, Is it possible to include perl script with in the unix shell script? What would be the general syntax? In the above case, is it required to write the below first two lines of codes? #!usr/bin/sh -x #!usr/bin/perl -w Thanks in advance / Mysore Ganapati. (1 Reply)
Discussion started by: ganapati
1 Replies

4. Shell Programming and Scripting

Perl script to copy contents of a web page

Hi All, Sorry to ask this question and i am not sure whether it is possible. please reply to my question. Thanks in advance. I need a perl script ( or any linux compatible scripts ) to copy the graphical contents of the webpage to a word pad. Say for example, i have a documentation site... (10 Replies)
Discussion started by: anand.linux1984
10 Replies

5. Shell Programming and Scripting

include virtual perl-script - submit button opens a new page..

hello 2 all I can't understand how to insert a perl-script into .shml in a right way. <form> should be working but it's not doing that: <!--#include virtual="/cgi-bin/script.cgi?filename"--> filename is a name of the file which script is using the script is used for a score show (the number... (0 Replies)
Discussion started by: tip78
0 Replies

6. Shell Programming and Scripting

Perl - radio button processing

Hi, I am hoping to get some help on perl. I am trying to process a HTML radio button selected value in perl. Basically What I am trying to do is 1. I have some radio buttons which indicated different colors. 2. I have a list box where I want to populate depending on the selected radio button... (1 Reply)
Discussion started by: devtakh
1 Replies

7. Shell Programming and Scripting

Validation of Text field while Click on submit button

I am using Perl CGI. I have created some text fields and getting those values. But i want if user leave the text field blank when he click on submit button then instead of run a script it should give a popup. Please any body suggest me something..??? (0 Replies)
Discussion started by: Navrattan Bansa
0 Replies

8. Shell Programming and Scripting

[SOLVED] Submit Button is not Recognizable

Hi ... I am writing a PERL CGI script where firstly i display a Submit button and when i click that, it will display a group of checkbox values and another submit button. My question is Now, if i click the second submit button, it should get the checkbox values and work with those(do some... (0 Replies)
Discussion started by: gkrish
0 Replies

9. Shell Programming and Scripting

Curl to hit the submit button

Hello, I am looking to hit a URL using curl and click on submit button so that I can get the results. The below is the code <input name="tos_accepted" id="tos_accepted" class="button" type="submit" value="Yes, I Agree"/> <input name="tos_discarded" id="tos_discarded"... (1 Reply)
Discussion started by: Kochappa
1 Replies

10. Web Development

Apache2 web application- Submit button - write data into a file

Hello, I am newbie on php-mysql and just know only installation. I have an apache2+php5+mysql installed VPS. What I would like to do is that when visitor enters requested data shown in index.html, submit button will run a script to save each field into a file. Here is an example shown in... (1 Reply)
Discussion started by: baris35
1 Replies
SSI(3pm)						User Contributed Perl Documentation						  SSI(3pm)

NAME
CGI::SSI - Use SSI from CGI scripts SYNOPSIS
# autotie STDOUT or any other open filehandle use CGI::SSI (autotie => 'STDOUT'); print $shtml; # browser sees resulting HTML # or tie it yourself to any open filehandle use CGI::SSI; open(FILE,'+>'.$html_file) or die $!; $ssi = tie(*FILE, 'CGI::SSI', filehandle => 'FILE'); print FILE $shtml; # HTML arrives in the file # or use the object-oriented interface use CGI::SSI; $ssi = CGI::SSI->new(); $ssi->if('"$varname" =~ /^foo/'); $html .= $ssi->process($shtml); $ssi->else(); $html .= $ssi->include(file => $filename); $ssi->endif(); print $ssi->exec(cgi => $url); print $ssi->flastmod(file => $filename); # # or roll your own favorite flavor of SSI # package CGI::SSI::MySSI; use CGI::SSI; @CGI::SSI::MySSI::ISA = qw(CGI::SSI); sub include { my($self,$type,$file_or_url) = @_; # my idea of include goes something like this... return $html; } 1; __END__ # # or use .htaccess to include all files in a dir # # in .htaccess Action cgi-ssi /cgi-bin/ssi/process.cgi <FilesMatch ".shtml"> SetHandler cgi-ssi </FilesMatch> # in /cgi-bin/ssi/process.cgi #!/usr/local/bin/perl use CGI::SSI; CGI::SSI->handler(); __END__ DESCRIPTION
CGI::SSI is meant to be used as an easy way to filter shtml through CGI scripts in a loose imitation of Apache's mod_include. If you're using Apache, you may want to use either mod_include or the Apache::SSI module instead of CGI::SSI. Limitations in a CGI script's knowledge of how the server behaves make some SSI directives impossible to imitate from a CGI script. Most of the time, you'll simply want to filter shtml through STDOUT or some other open filehandle. "autotie" is available for STDOUT, but in general, you'll want to tie other filehandles yourself: $ssi = tie(*FH, 'CGI::SSI', filehandle => 'FH'); print FH $shtml; Note that you'll need to pass the name of the filehandle to "tie()" as a named parameter. Other named parameters are possible, as detailed below. These parameters are the same as those passed to the "new()" method. However, "new()" will not tie a filehandle for you. CGI::SSI has it's own flavor of SSI. Test expressions are Perlish. You may create and use multiple CGI::SSI objects; they will not step on each others' variables. Object-Oriented methods use the same general format so as to imitate SSI directives: <!--#include virtual="/foo/bar.footer" --> would be $ssi->include(virtual => '/foo/bar.footer'); likewise, <!--#exec cgi="/cgi-bin/foo.cgi" --> would be $ssi->exec(cgi => '/cgi-bin/foo.cgi'); Usually, if there's no chance for ambiguity, the first argument may be left out: <!--#echo var="var_name" --> could be either $ssi->echo(var => 'var_name'); or $ssi->echo('var_name'); Likewise, $ssi->set(var => $varname, value => $value) is the same as $ssi->set($varname => $value) $ssi->new([%args]) Creates a new CGI::SSI object. The following are valid (optional) arguments: DOCUMENT_URI => $doc_uri, DOCUMENT_NAME => $doc_name, DOCUMENT_ROOT => $doc_root, errmsg => $oops, sizefmt => ('bytes' || 'abbrev'), timefmt => $time_fmt, MAX_RECURSIONS => $default_100, # when to stop infinite loops w/ error msg COOKIE_JAR => HTTP::Cookies->new, $ssi->config($type, $arg) $type is either 'sizefmt', 'timefmt', or 'errmsg'. $arg is similar to those of the SSI "spec", referenced below. $ssi->set($varname => $value) Sets variables internal to the CGI::SSI object. (Not to be confused with the normal variables your script uses!) These variables may be used in test expressions, and retreived using $ssi->echo($varname). These variables also will not be available in external, included resources. $ssi->echo($varname) Returns the value of the variable named $varname. Such variables may be set manually using the "set()" method. There are also several built-in variables: DOCUMENT_URI - the URI of this document DOCUMENT_NAME - the name of the current document DATE_GMT - the same as 'gmtime' DATE_LOCAL - the same as 'localtime' LAST_MODIFIED - the last time this script was modified $ssi->exec($type, $arg) $type is either 'cmd' or 'cgi'. $arg is similar to the SSI "spec" (see below). $ssi->include($type, $arg) Similar to "exec", but "virtual" and "file" are the two valid types. SSI variables will not be available outside of your CGI::SSI object, regardless of whether the virtual resource is on the local system or a remote system. $ssi->flastmod($type, $filename) Similar to "include". $ssi->fsize($type, $filename) Same as "flastmod". $ssi->printenv Returns the environment similar to Apache's mod_include. $ssi->cookie_jar([$jar]) Returns the currently-used HTTP::Cookies object. You may optionally pass in a new HTTP::Cookies object. The jar is used for web requests in exec cgi and include virtual directives. FLOW-CONTROL METHODS The following methods may be used to test expressions. During a "block" where the test $expr is false, nothing will be returned (or printed, if tied). $ssi->if($expr) The expr can be anything Perl, but care should be taken. This causes problems: $ssi->set(varname => "foo"); <!--#if expr="'$varname' =~ /^foo$/" -->ok<!--#endif --> The $varname is expanded as you would expect. (We escape it so as to use the $varname within the CGI::SSI object, instead of that within our progam.) But the $/ inside the regex is also expanded. This is fixed by escaping the "$": <!--#if expr="'$varname' =~ /^value$/" -->ok<!--#endif --> The expressions used in if and elif tags/calls are tricky due to the number of escapes required. In some cases, you'll need to write "\\" to mean "". $ssi->elif($expr) $ssi->else $ssi->endif SEE ALSO
"Apache::SSI" and the SSI "spec" at http://www.apache.org/docs/mod/mod_include.html AUTHOR
(c) 2000-2005 James Tolley <james@bitperfect.com> All Rights Reserved. This is free software. You may copy and/or modify it under the same terms as perl itself. CREDITS
Many Thanks to Corey Wilson and Fitz Elliot for bug reports and fixes. perl v5.12.4 2007-08-08 SSI(3pm)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy