[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Check to see if the submit button was pushed using PERL

Posted on 2004-10-03
6
Medium Priority
?
314 Views
Last Modified: 2013-12-25
I'm a newbie when it comes to Perl so bear with me.  There's a page I have with a form and when the person submits it it'll call itself to check if all fields were entered then go to another page if all were.  But I can't figure out what the function or method is to check if the submit button was pushed.  Any help would be appreciated.

Thanks.  
0
Comment
Question by:kevin_ma
6 Comments
 
LVL 16

Expert Comment

by:xDamox
ID: 12212572
Hi,

you should make the form pass all the fields to your script then go though them checking
then if theres an error display the error message else send the email
0
 
LVL 15

Assisted Solution

by:nicholassolutions
nicholassolutions earned 400 total points
ID: 12212934
You probably have a line like this in your HTML form code, correct?

<INPUT TYPE=SUBMIT NAME="buttonname" VALUE="Button Label" >

This is just like the other values in your form -- it passes the script a variable $buttonname = "Button Label";

So, to check if the submit button was pressed just use this:

if ($buttonname eq "Button Label"){
   #do something
}


0
 

Author Comment

by:kevin_ma
ID: 12213032
I tried that already, it doesn't work.   For example in ASP you have the request.form which you can use to refer to it, but in PERL I'm not sure what it is.  Anyways I found another way around it...
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 85

Accepted Solution

by:
ozo earned 1600 total points
ID: 12213170
use CGI qw/:standard/;
if( param("buttonname") eq "Button Label" ){
}
0
 
LVL 15

Expert Comment

by:nicholassolutions
ID: 12213175
Thanks ozo -- I guess I assumed he'd do

$buttonname = param("buttonname");

sorry I left that out in my code above.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12213357
Your description is a little unclear.

Do you want to check for the fields being entered *before* the form is submitted or after?

If before, then you need to use Javascript for the validation.  If after, then just check each field name for existence, eg:

use CGI ':standard';

Empty("Field1 is empty") unless param("field1");
Empty("Field2 is empty") unless param("field2");

sub Empty {
  my $msg = shift;
  print header, $msg;
  exit;
}

Adjust the field names to whatever you have in your form.

It may help if you show us the relevant HTML section of your form.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses
Course of the Month19 days, 22 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question