473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Perl Script that gets data from a form

Alright I just want to get the entered data from the html form and process it to store it as a variable can someone give me an example of this please.

Expand|Select|Wrap|Line Numbers
  1. #!c:\perl\bin\perl -t
  2. use strict;
  3. use warnings;
  4.  
  5. $user_input = 
  6.  
I'd like the $user_input to be whatever the user entered in the guessedNumber text input.

Html
Expand|Select|Wrap|Line Numbers
  1. <form METHOD="POST" ACTION="guessNumber.cgi">
  2. Guessing Game<br>
  3. <br><br>
  4. Enter a number between 1 & 100 <br>
  5. Guess:  <input type="text" name="guessedNumber" maxlength=3 size=5><br>
  6. <input type="submit" value="Enter Guess">
  7. <input type="reset" value="Reset"><br>
  8. <input type="hidden" name="msgDisplay" value="Display Message">
  9. </form>
  10.  
Feb 22 '09 #1
5 1903
eWish
971 Expert 512MB
If you search this forum you will find many examples of getting data from a form. Here is a link to a script I did as an example. It also uses HTML::Template.

It is a nice example. Also, check the documentation for the CGI.pm as well.

--Kevin
Feb 22 '09 #2
Could you just make an example from the information I gave or am I lacking information to give an example or is my question to complicated to give a quick example? It's just I find your example long and complicated and a little hard to understand for what I need to do.
Feb 22 '09 #3
numberwhun
3,509 Expert Mod 2GB
In the future, please do try and search Google for the answers that you seek before posting here. You will learn more if you get the answer on your own and figure it out than if you wait for an answer here.

A quick google search like this would have provided plenty of links for you to figure this out.

Regards,

Jeff
Feb 22 '09 #4
eWish
971 Expert 512MB
Your example is not to complicated. Here is a more basic example.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -T
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. use CGI;
  7. use CGI::Carp qw/fatalsToBrowser/;
  8.  
  9. my $q = CGI->new;
  10. my $user_input = $q->param('guessedNumber');
  11.  
  12. print $q->header;
  13. print $user_input;
  14.  
  15. 1;
Is that more of what you are looking for?

--Kevin
Feb 22 '09 #5
Yea thanks for simplifying that.
Feb 22 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: phal | last post by:
Hi all; I code Perl for CGI, I using regular expression to check the validation of user input, because the form is small and it run only from my own computer, anyways if many people using my...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
0
by: supern | last post by:
this is my perl script saved as login.pl #!c:/perl/bin/perl.exe $basedir="c:/program files/apache software foundation/apache2.2/cgi-bin"; $datafile="regstr.txt"; $name=$in{'login'};...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
2
by: dandaman2007 | last post by:
Hi All, I need some expertise Perl help..... Basically i have an Email perl script that i use on alot of my sites, which basically E-mails the filled in form to a specified e-mail address....
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
82
by: happyse27 | last post by:
Hi All, I modified the user registration script, but not sure how to make it check for each variable in terms of preventing junk registration and invalid characters? Two codes below : a)...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
3
by: happyse27 | last post by:
Hi All, I am creating the perl script using html form(with embedded javascript inside). When using this html form with javascript alone, it works where the form validation will pop up...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.