Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: CGI parameter passing (was Aardvark)

by fpi (Monk)
on Mar 12, 2001 at 04:01 UTC ( [id://63697]=note: print w/replies, xml ) Need Help??


in reply to CGI parameter passing (was Aardvark)

well, if aardvark is going to take some time to figure out what your problem is, I thought I would try to help out...

You need to back out and give us an idea of the setup of "page one" and "page two". At first I thought that you were using a perl script to generate both pages and handle the CGI, as probably did aardvark, who suggested a dispatch table. But the more I read your second post, it looks like "page one" and "page two" are html files and you have a perl script to handle the CGI from page two.

If my assumption is correct, you are then asking how to get the data inputted from "page 2" or the database to be displayed in a field in "page 1". Correct?

When you are opening "file.cgi" what is file.cgi??? The database or "page 1" html? When it is being "appended" to the bottom, the bottom of what - a database or an html file?? (The ">>" usually signals an append, although I believe it should be with the filename?)

When you say you want the data to appear in a field, do you mean a CGI form field? If so, the only way to do that is if you are using perl to generate the html for page one on the fly, and you stick the desired data within the form element's VALUE tag or within the TEXTAREA tags (this is basic form HTML).

My suggestion is to take a step back and think about what you are doing first, so you can plan an approach instead of looking for a patch solution.
  • Comment on Re: CGI parameter passing (was Aardvark)

Replies are listed 'Best First'.
Re: Re: CGI parameter passing (was Aardvark)
by rootkidd (Initiate) on Mar 12, 2001 at 17:27 UTC
    Hi FPI. Sorry, My description was very vague. This may be better I hope.

    page1 is a cgi script with no commands, it merely has 4 submit buttons which allow a user to either open or close an alarm for the primary or secondary server. The buttons are open1 close1 open2 close2. When a user closes an alarm it opens an html page and asks for input in several fields. This information is then extracted from the webpage and added to an archive. What I need is once the user submits the information to be archived, for a timestamp to be placed in a text field on the main page that holds the buttons. I can get the stamp to be appended to the file but Im having dificulty getting the timestamp placed in a field rather than merely appended.
    Im sorry for all the posts but I just cant find any information anywhere. I dont really have the first idea what to do as I have just been thrown into the deep end by my boss and asked to develope this. I have never used perl before so I'm kinda blind as to what I should do. The logic behind it is simple, I just cant seem to impliment a way to append the information to a field on a seperate page.

    I'd like to thank you guys for being so patient with me, I really appreciate it.

      OK, since you addressed me, I will try to offer more help.

      First of all, when you are continuing a discussion of the same question, keep it within the same thread and don't start a new one. There is no way we can follow your discussion otherwise. And go ahead and create a user ID for perlmonks - it costs nothing and the perlmonks users will probably look upon you more kindly if you had a name (not just "anonymous"), and they knew you were a newbie.

      Having said that, you should know that some of the perlmonks users apparently have been trying to clean up the little thread mess that you left, with deletions of duplicate entries and keeping things organized. I assume that the original anonymous poster is NOT the same as rootkidd, and rootkidd is just trying to help out and repost your question that got deleted and lost otherwise. If so, thanks rootkidd- you got my vote. Now if rootkidd is the same as the original anonymous poster, then good, you are on the right track.

      OK, back to your question. be assured that what you are trying to do is really easy, as long as you know both your perl and your html. Let's break this down:
      -page1 = "page1 is a cgi script". cgi is the protocol, not the language. so what is your "cgi script"? a perl script that generates your form, or an html page with the form? this is important to know this because it is where you apparently want the timestamp to appear.
      -page2 = an html page with a cgi form. correct?
      -in between page1 and page2= I assume that the form tag on page1 calls a perl script which closes the alarm and redirects to page2, although it is probably not important to know that right now.
      -in between page2 and the return to page1= a script which writes to the archive, puts a timestamp that appears in page1. Correct? And then redirects the user back to page1

      You also really need to define what you mean by placing the timestamp "in a text field" versus "appending the file"? What file?? Page1? or some log or temporary file? This is important because there is no way to make a timestamp appear "in a text field" of a form in an html page if you are appending the timestamp to the bottom of that html page.

      And are you appending to a list of timestamps, or only saving one timestamp? And does the timestamp really need to be within a form text field, or can the timestamp just be displayed on the webpage as simple text, just like all other text on the webpage??

      Basically it's like this: if "text field" means a form text field, then the only way to dynamically set the value of the text field is if page1 is an html page generated by perl. But we still can't figure out if your page1 is a static html page or a web page generated by perl on demand.

      But you also say that you are writing the timestamp to a file. If page1 is a static html page, then it is possible for the perl script to parse the html of page1 and plug (write) in the timestamp to the correct location, and then redirect the user to see the output of the newly-modified page1 html. This is an easy solution, but you need to know how to manually parse your specific html file and where and how to stick the timestamp - just as simple text in the proper location, or within the VALUE tag for a FORM element.

      A third option, if page1 is static html, is to use Server-Side Includes (SSI), which is also really easy, but I am hesitant to get into this if you don't seem to have a grasp on the setup of your scripts. Basically with SSI, you just put the SSI tag in your page1 html of where you want the timestamp to appear. But you need to have SSI activated on your webserver, change the extenstion of your page1, and you need the perl script which will return the timestamp in the SSI call.

      For the first and third options, it is also perfectly acceptable to write the timestamp to a file - a log file or a file that just saves the latest timestamp. then page1 would get its data from that logfile. In other words, this is one way of "passing" the info to page 1.

      So we have solved nothing because there are still too many questions about what you are asking and what is your setup. If you continue this discussion, please "reply" to keep it in the same thread, and don't start a new thread. And seriously consider getting a user ID.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://63697]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-19 20:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found