1.) The script proceeds to the 2nd form without me completeing the 1st. Problem 2.) The 2nd form is upended at the bottom of the 1st, not in its own window.

Sounds to me like you're operating under the assumption that your script will run once. CGI doesn't work that way. Your script will run each time the user loads the page, whether they do it by hitting reload, by clicking submit, or whatever. Each time it runs, it should only print the one page that is wanted under the circumstances. For example, if the user hasn't submitted any form yet, you want to print the blank first form. If they are just now sumbitting the first form, you want to print the second one (assuming that their answers to the first are okay). If they're submitting the second form, you want to print some kind of confirmation. So you want to do something along these lines...

%input = getforminput(); # That's another thread... if ($input{formsubmitted}==2) { # user submitted form2. Process it and print a # "form sumbitted" advisory page. } elsif ($input{formsubmitted==1) { # user submitted form1. Process it and print form2. } else { # User didn't submit anything yet. Print form1. }

This is just a basic structure. You may alter it an any number of ways. For example, you may wish to validate the forms the user has submitted and make the user correct any mistakes, only giving them the next form (or results) if they've given satisfactory answers to all required fields. Also note that the formsubmitted input is not magic; your form has to supply it. One way to do it is to put hidden fields in your forms, for example:

<input type="hidden" name="formsubmitted" value="2"></input>

$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: Multiple form survey by jonadab
in thread Multiple form survey by Anonymous Monk

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.