Hi. I need to create 3 pages. Page 1 requests the number of elements the user wants to add and average. Page 2 asks the user for the numbers. Page 3 adds and averages the numbers and displays them. I can't create a separate page 3 to do this. Page 3 shows the contents of page 2 in addition to the contents of page 3. How do I get only the contents on page 3 to display separately? Everything works so I'm just asking how to do this. Any feedback would be appreciated. Thanks in advance. Here is my code: 15 3481 KevinADC 4,059
Recognized Expert Specialist
Without going into the whole use "strict" and "warnings" and the CGI module speech, and changing too much of the code you already have, here is one way how (I think) you can do what you want. Ask questions if necessary.
Nope, it didn't work. It's doing the same thing. I thought using hidden values may work, but I guess not. What about using path info? Any thoughts?
EDIT: Actually, now that I look at it more closely, the text that is supposed to be separate on page3 is already being shown on page2. When the submit button is clicked on page2, the math is performed and the text is updated to show the sum and average. I think this was happening before I edited it with your suggestions as well.
KevinADC 4,059
Recognized Expert Specialist
I tested your code and my code and they do not do the same thing. My code shows each page in succession, and only that page. Your code shows page one, then page two with page three output displayed in page two, then page three output with page two output also displayed.
I assumed that was what you wanted to do judging by your not very clear description of the behavior you were seeking.
I copied your code and pasted it in a new file then ran it, and it's doing the same thing as mine for me. If you go to this link, you can run all three programs I have and their code as well. http://web.cs.sunyit.edu/~westj2/cgi-bin/
The programs are assignment4_CS_ credit.cgi, assignment4_CS_ credit2.cgi, and assignment4_CS_ credit3.cgi.
Version 3 is the program with the code you suggested.
RonB 589
Recognized Expert Moderator Contributor
The link for the action attribute is pointing to the wrong script, which is why you think Kevin's script is doing the same thing as yours.
I'm still trying to decide if I want/should post a properly written script, which I probably won't because this is clearly a homework assignment. If I do, it will be one that your instructor won't accept, because it will use some "advanced" items that would probably not have been covered in your class.
Ron
aka FishMonger
Doh! Thanks Ron and Kevin. It works now.
KevinADC 4,059
Recognized Expert Specialist @RonB
Yikes... I think this guy is stalking me! ;)
RonB 589
Recognized Expert Moderator Contributor @KevinADC
What should I do when I catch you! :) :)
KevinADC 4,059
Recognized Expert Specialist @RonB
hmm.... never thought about that. Buy me a Margarita? ;)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: william c |
last post by:
I don't really know PHP that well.
I'm fixing a Perl program that accesses a db after getting form input
from a PHP page. If the server-side validation fails I'd like to reload
the form with all the user's info still filled in.
I could embed the entire page in the Perl program but it seems like
there must be a better way to go. Is there a way to get the info into
the Post environment variable and add code for the PHP page to read it...
|
by: Andrew DeFaria |
last post by:
I have somebody or some people who are abusing a Perl based .cgi script.
I have written a PHP page which reports this abuse as per
$_SERVER. My intentions were to replace the .cgi script
with this .php script. Problem is these people are coming in with some
web crawler or something like that (i.e. wget
http://myserver.com/thescript.cgi). Now if I replace thescript.cgi with
thescript.php they will not hit it. And if I replace thescript.cgi...
|
by: Xah Lee |
last post by:
# -*- coding: utf-8 -*-
# Python
# suppose you want to fetch a webpage.
from urllib import urlopen
print
urlopen('http://xahlee.org/Periodic_dosage_dir/_p2/russell-lecture.html').read()
# note the line
# from <library_name> import <function_name1,function_name2...>
|
by: crunix |
last post by:
Hello.
I have developed a medical application with php 4 linked to IBM DB2
database.
The database connection is right and i can access data with no
problem...but sometimes when i reload the page which has been already
loaded (by pressing CTRL-R) i receive an SQL STATE Error:
"(...) SQL State: X (..)"
|
by: scottyman |
last post by:
I can't make this script work properly. I've gone as far as I can with
it and the rest is out of my ability. I can do some html editing but
I'm lost in the Java world. The script at the bottom of the html page
controls the form fields that are required. It doesn't function like
it's supposed to and I can leave all the fields blank and it still
submits the form. Also I can't get it to transfer the file in the
upload section. The file name...
| |
by: Thomas Blabb |
last post by:
Sorry for this question but how do I write a simple "Hello world" HTML page from a
perl script?
In other words if I click in an already existing html page on a link like:
....
<a href="/export/home/aaa/cgi-bin/writehello.pl" target="_top">Click on this link</A>
....
a html page with the following stuff should be written and displayed in the browser:
|
by: benwylie |
last post by:
I am running IIS 6.0 on Windows 2003.
I would like to be able to run a perl script from a web page and
include the output.
I have tried doing it with an ssi:
<form action='docsearch.shtml' method='get'>
<!--#exec cgi="/cgi-bin/docsearch.pl-->
</form>
This correctly ran the script, but it was unable to include the
|
by: sandy |
last post by:
hello,,,,,,,,,
i am creating login page using Perl/CGI facing prob... able to
connect DB but from there facing prob
If u have related code of login page in Perl please send me on
sandip.bhosale@gmail.com
please help me
i am using MySQL as DB user name:root password:root database name:ITS
|
by: owlice |
last post by:
Greetings!
I thought I'd add a little something to a web site, a "tip of the week," and wanted it automated so that if I get hit by a truck (or, more likely, am forgetful), the tip is updated automatically.
I learned enough Perl (read: just enough) to code a script that does what I want it to do. Now the question is: how to get it to run automatically.
I would like the program to be invoked when someone, anyone, hits my homepage. I...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |