Is there a way for a basic href url to call a fuction within perl that will write a new page like I want it to do? Is there a way to have a user select a page from a list, then change to that page?

URL's don't call functions, they just establish the host from which the request will be made and perhaps the parameters of the request itself (if you're using, say, "/cgi-bin/mycgi.cgi?p=5"). After that, it's all up to you to ensure that the right thing happens, and more importantly, that no wrong thing happens. Yes, there is a way to get from the information available to the correct solution -- all dynamically generated web content you've ever seen, and every application you've ever launched on your own computer has done exactly that, after all.

Maybe it's not sinking in just yet, but you've been given several viable options to think about. Maybe you're a bit too new to programming to have the mental habits and breadth of information that will easily guide you through to a solution? If that's the case, you're going to have to expend some brain sweat to get there. Don't worry, it won't hurt. At least not too much. It will be worth the effort, even if your first go at it fails miserably.

Please forgive me if I'm assuming wrongly about your experience level in what follows. It's difficult to gauge another's knowledge and skill without a good bit of discussion, and I'm just doing the best I can to help you along with what little I know right now. Some suggestions to get you on track:

Sit down with a pencil and paper and write out what you expect your application to do, case by case and step by step. Don't even think of tapping the keyboard until you've got the whole darn thing reduced to scribble. You want at least a very good outline to start with: in this case it will do this, in this other case it will do this other thing, et cetera. Then fill in between each "in this case" and its corresponding "it will do this" with the logical steps that define what "do this" means and how it will be accomplished. By the time you're done, a possibly doable solution will probably suggest itself to you. If not, think on it some more, expend that brain sweat. Then take just one case and code it up. Make it work, at least mostly. Then work a second case into the code and provide the logic that will allow the thing to decide which response is appropriate. By that point you've got a skeleton of some hopefully reasonable logic that at least mostly works. And at that point you can set that bit of code aside and start over with your now hopefully more refined idea of what should happen. Always always always write one to throw away.

Above all else, have fun with it. Every application solves a problem ranging from "I want the string 'Hello World' to appear on my display" to "I want to solve all of the world's problems with a computer". How to get from the basic idea to the implementation of a fully working solution is a puzzle, hopefully an intriguing puzzle that will simultaneously exercise and entertain your mind.

You've been given several viable options to get you started. So get started!


In reply to Re^2: Multiple Pages with CGI by gloryhack
in thread Multiple Pages with CGI by Trihedralguy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.