473,406 Members | 2,769 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,406 software developers and data experts.

How to display the html form output on the same page using perl script?

147 100+
Hi,

Please see the below one :
Expand|Select|Wrap|Line Numbers
  1. #!c:/perl/bin/perl
  2. use CGI qw(:all);
  3.  
  4. print "Content-type:text/html\n\n";
  5. print <<EndOfHTML;
  6. <html><head><title>Print Environment</title></head>
  7. <body>
  8. <FORM action="sample.cgi" method="POST">
  9. First Name: <input type="text" name="first_name">  <br>
  10.  
  11. Last Name: <input type="text" name="last_name">
  12.  
  13. <input type="submit" value="Submit">
  14. </FORM></body>
  15. EndOfHTML
  16.  


From this, i don't know to proceed. There are two text box with First Name and the Last Name. When submitting the form to itself by clicking "submit button", the First Name and the Last Name should display on the same page, that is at the bottom of the two text boxes. Please help me out. Thanks in advance

Update:
I am calling the same program as "sample.cgi". As you seen my code, is the "sample.cgi" only.
Mar 1 '11 #1
2 4026
numberwhun
3,509 Expert Mod 2GB
So what is the contents of the script "sample.cgi"?

I don't see anything in this code that would print the first and last name like you say.

Regards,

Jeff
Mar 1 '11 #2
miller
1,089 Expert 1GB
You need to spend a little more time studying the cpan documentation for CGI.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -wT
  2.  
  3. use CGI;
  4.  
  5. use strict;
  6. use warnings;
  7.  
  8. my $q = CGI->new;
  9.  
  10. print $q->header();
  11.  
  12. print qq{<html>
  13. <head><title>Print Environment</title></head>
  14. <body>
  15. <form method="POST" action="sample.cgi">
  16. <p>First Name: } . $q->textfield(-name=>'first_name') . qq{
  17. <p>Last Name: } . $q->textfield(-name=>'last_name') . qq{
  18. <p><input type="submit" value="Submit"></p>
  19. </form>
  20. <h2>Results</h2>
  21. <p>First is "} . $q->escapeHTML($q->param('first_name')). qq{"</p>
  22. <p>Last is "} . $q->escapeHTML($q->param('last_name')). qq{"</p>
  23. </body>
  24. </html>};
  25.  
Mar 2 '11 #3

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

Similar topics

1
by: norma | last post by:
How can i make refresh of a HTML page using Perl? At this moment i am using "<META HTTP-EQUIV='REFRESH' CONTENT='900;URL= ....... " buth i want to refresh the htlm page every 15 minutes using de...
4
by: kk5151 | last post by:
Hi, Would like to learn and know how to sort the ip address using perl script? For example: 172.27.32.200 172.19.32.100 10.1.1.60 192.20.30.133
1
by: shaji66 | last post by:
how to update values in HTML page using java script: hi all , I want to update some text fields in html , and display these values in another page .... can you please help me in writing...
4
by: jram01 | last post by:
Hi Folks, I am facing problem to to execute .sql command in sql prompt using perl script. I am able to connect sql promt using " my $odbcinput = "odbcinput.txt"; my...
5
by: leierwu | last post by:
1. I have a folder containing several files; 2. Now these files should be added a header with the file name in the first line; How can I complish this using perl script?
1
by: nehaz | last post by:
can anyone tell me how can i configure a device from HTTP page using perl ? I am using following cmd to enter the http page use HTTP::Request; $req = HTTP::Request->new($httpRequestMethod =>...
3
by: gajendra98 | last post by:
Hi I am working on windows .....IS it possible to block the remote computer python plug-ins using perl script...could some one tell me how to perform these operations.....Thanks
1
by: hvivekw | last post by:
Hi, I would like to open a web page using Perl. I have a device on the internet whose web user interface I would like to open and subsequently automate some of the tabs on that web page. Is...
3
by: flow3rgirlz | last post by:
Hi all, I'm really new to Perl. I'm not sure where to post my topic as it between Perl and Visio. Anyway, I want to run a Visio macro automatically using Perl Script. $vis->Run($macro_to_run);...
1
by: sree ram | last post by:
code for getting maximum rows in excel sheet using perl script
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.