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 3363
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.
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
Expert Mod 512MB
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.
@RonB
Yikes... I think this guy is stalking me! ;)
RonB 589
Expert Mod 512MB @KevinADC
What should I do when I catch you! :) :)
@RonB
hmm.... never thought about that. Buy me a Margarita? ;)
hehehe.... maybe one of these days I'll take you up on that. BTW, welcome to bytes.com :)
RonB 589
Expert Mod 512MB @KevinADC
I might even get behind the bar, which usually means I lower their profit margin, so beware. :) @KevinADC
Thanks,
I'm starting to see the other sites we're on slow down (or I'm just getting bored) so I need to add a few more to my "resume".
This perl forum used to be hopping. Look at my post count in just a little over two years as a member here. Sure, some of it is not in the perl forum but the majority is. This forum went nearly dead about 6 to 7 months ago when some forum changes were made. Its getting a little activity now but not even close to what it used to be.
NeoPa 32,468
Expert Mod 16PB
It's great to see you popping back Kevin - if only now and then.
No promises, but we're hoping to have a change (or two) released shortly which may allow the site to grow again (to stop it's further decline at least). Watch this space (but keep the breathing going - I don't have any dates yet).
@NeoPa
That is absolutely good to hear. Thanks for the info! :)
Post your reply Sign in to post your reply or Sign up for a free account.
Similar topics
9 posts
views
Thread by william c |
last post: by
|
9 posts
views
Thread by Andrew DeFaria |
last post: by
|
2 posts
views
Thread by Xah Lee |
last post: by
|
5 posts
views
Thread by crunix |
last post: by
|
6 posts
views
Thread by scottyman |
last post: by
|
reply
views
Thread by Thomas Blabb |
last post: by
|
4 posts
views
Thread by benwylie |
last post: by
|
reply
views
Thread by sandy |
last post: by
| | | | | | | | | | | |