in reply to Re^3: Parse form data to database
in thread Parse form data to database
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.#!/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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Parse form data to database
by graff (Chancellor) on May 13, 2006 at 04:47 UTC | |
by tryharder (Initiate) on May 13, 2006 at 05:19 UTC | |
by graff (Chancellor) on May 13, 2006 at 05:58 UTC | |
by tryharder (Initiate) on May 13, 2006 at 17:03 UTC |