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..

Your question is a little muddled... If I understand you correctly, the perl script is outputting the "<form>" section of that code? If so, you can't get that to work wholly "in the browser". The perl part never runs inside the web browser, only on the web server.

yes i'm kind of noob in web-programming. did not much forms yet :slight_smile:
thing is not in outputting the form
the thing in a new window which is opening when submitting the form
the form have a target you can use <form action=script target=newwindow>
then main page will be without changes and script output will be in newwindow
also it is possible to use ajax for smooth but i don't know ajax :frowning:
so how to NOT open the newwindow or immediately close it - is it possible?
or how to do it smooth without ajax?

---------- Post updated at 03:57 PM ---------- Previous update was at 10:14 AM ----------

ok found the answer:
<iframe name=someframe height=0 width=0 frameborder=0></iframe>
<form action=script target=someframe>

then there will be no windows and no visible changes on the page..
but still not smooth.. need ajax it seems

Anything that runs on the server only happens when a URL gets loaded. If you don't use Javascript to make a retrieval happen silently(aka AJAX), then the web browser itself must load and display the page, i.e. reload, or load a new page.