Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form in perl and getting the input in the same perl script 2

Status
Not open for further replies.

math

Programmer
Mar 21, 2001
56
BE
Hi,

I have a form that is first protected with a password... If I put the form in a seperate HTML then smart users can skip the password-protection... Making the form inside the perl-script is easy but I don't have a clue how to get the info out of the form...

Can anyone help??

Please..

Math
 
I'm not sure I understand the question. Do you mean that you want to know how to get the values of form variables into a perl program?
Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Yes, I do... but the form itself is in the perl-script also...

so the perl-script first writes the form and than does something with the information the user has given...

math
 
If you're writing the 'Form' in HTML, all you need to do, is set the <FORM> tag without any action as shown below:

<FORM NAME=&quot;myform&quot; METHOD=POST ENCTYPE=&quot;application/x-
This will cause the script to submit to itself, sending your inputs back into the script. If you'd like, I can e-mail you a sample script that does take input from itself (or it could take it from an outside script) and processes the results.

- George
 
George,

Thank you for your help... and yes, I would like to have a sample code, If you would send it to math_00@hotmail.com, I would be so thankfull

Great Help

Thanx,
Math
 
I guess what you trying to do is not to show the form again when parsing from the form to the same script.Maybe this will help.

use CGI qw/:standard/;
$q->new CGI;

$action = $q->param('action');
if($action eq 'login'){
&login();
}else{&first();}

sub first{
print <<EOF;
<html .......
<form action=&quot;$cgiurl&quot; method=&quot;POST&quot;>
#whatever you want to have here as an input.
<input type='hidden' name='action' value='login'>
#the vital part is the hidden field here.The rest goes as usual.
......................
EOF
}
sub login{
....
}
 
Perllees, that's very similar to the method I use to have a perl program both create and process a form. I even set the action to other values, such as &quot;error&quot; if I have to return an error message, so I know what's going on. Since you're creating the form in the program, it's easy to set the value of action to whatever you need it to be, and handle it when you get back. Good answer! Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top