I have a project in which i have an html page.There I have a Submit Button using which i have to call a perl subroutine, carry out some function and return the value. The problem is that i am not able to pass the value to the subroutine. Also is there a way to use $_Get or $_Post i n perl??
I am posting my script below
#!/usr/bin/perl -w
use CGI::Ajax;
use CGI;
sub functions {
my $Fn = $_Get['Function'];
my $input = shift;
if(1)
{
return ("True");
}
if(0)
{
return ("False");
}
}
sub Show_HTML {
my $html = <<EOT;
<HTML>
<HEAD><title>Perl and HTML</title>
</HEAD>
<BODY>
<script type="text/javascript">
function CheckIsNumeric()
{
var AsciiCode = event.keyCode;
if ((AsciiCode < 48) || (AsciiCode > 57))
{
alert('Please enter only numbers.');
event.cancelBubble = true;
event.returnValue = false;
}
}
</script>
<Form method="Get">
<select name="Function">
<option value="0" selected>(please select:)</option>
<option value="1">Func1</option>
<option value="2">Func2</option>
</select>
Enter a number:
<input type="text" name="Number" id="myText" size="6"onkeypress ="
+CheckIsNumeric()"/>
Enter a function:
<input type="text" name="fns" id="URI" size="25">
<input type='Submit' onsubmit="functions('fns');" value='Submit' /
+>
</Form>
<hr>
<div id="resultdiv">
</div>
<br>
</BODY>
</HTML>
EOT
return $html;
}
my $cgi = new CGI();
my $pjx = new CGI::Ajax( 'functions' => \&functions );
print $pjx->build_html($cgi,\&Show_HTML);
what i want to do is pass the fns's value to the subroutine and return a value.
Kindly Help. Thanx in advance.