Solved

Check to see if the submit button was pushed using PERL

Posted on 2004-10-03
6
300 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 100 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 84

Accepted Solution

by:
ozo earned 400 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

707 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now