Leocharre, here's my dilema. I've worked a week on this thing, and moved inches only to be set back several feet. I have the form working, with form action posting to cgi script, which then returns a confirmation page. But, I don't think the script is correct for what else I need to do. I am sure the process is simple, if one knows basic code. I'm not concerned with security just getting it to perform as follows: Complete a form which, when submitted, calls a script that parses the data input into the form, checks a flat file to see if the User ID is present and if so, advise to select different User ID. If not found then confirm data entered. If former user does not remember password, provide form requesting the user ID, and on submit have password emailed to the individual, based on the email address from the flat file. Here is the cgi script I have which is in the form action used on the form submit. It only sends confirmation and input submitted:
#!/usr/bin/perl print "Content-type:text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/\n/ /g; # replace newlines with spaces $value =~ s/\r//g; # remove hard returns $value =~ s/\cM//g; # delete ^M's $FORM{$name} = $value; } print <<EndHTML; <html><head><title>Thank you</title></head> <body> <h2>Thank You, $FORM{'fnameRN'} $FORM{'lnameRN'}!</h2> Here is the information you provided:<p> <table width="38%" border="1" cellspacing="0" cellpadding="0"> <tr> <td>First Name: </td> <td>$FORM{'fnameRN'}</td></tr> <tr> <td>Last Name: </td> <td>$FORM{'lnameRN'}</td></tr> <tr> <td>Street Address1: </td> <td>$FORM{'addr1RN'}</td></tr> <tr> <td>Street Address2: </td> <td>$FORM{'addr2RN'}</td></tr> <tr> <td>City: </td> <td>$FORM{'cityRN'}</td></tr> <tr> <td>State: </td> <td>$FORM{'stRN'}</td></tr> <tr> <td>Zip: </td> <td>$FORM{'zipRN'}</td></tr> <tr> <td>Email: </td> <td>$FORM{'emailRN'}</td></tr> <tr> <td>UserID: </td> <td>$FORM{'uidRN'}</td></tr> <tr> <td>Password: </td> <td>$FORM{'pwd1RN'}</td></tr> </table> Thank you for your feedback.<p> <a href="http://matrix.csis.pace.edu/~s06-it154a-s04/register.html">Cl +ick here</a> to return to form to make any changes, OR<br> <a href="http://matrix.csis.pace.edu/~s06-it154a-s04/cgi_scripts.html" +>Click here</a> to return to the home page. </body></html> EndHTML sub dienice { my($msg) = @_; print "<h2>Error</h2>\n"; print $msg; exit; }
Preceding the print <EndHTML; I tried to incorporate open(OUTF, "form.txt"); followed by a print OUTF for all the $FORM fields then close (OUTF); but it did not work. I have until midnight Monday to get this resolved, or will just have to submit as is. If you or anyone can assist, I would be grateful.

In reply to Re^4: Parse form data to database by tryharder
in thread Parse form data to database by tryharder

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.