Last week I posted a
question about how to modify a script to post a string to MySQL.
CountZero kindly provided the right answer, but not to the question I *thought* I had asked about... :-|
close (GUEST);
my $content;
open FILE, '<', $guestbookreal; # Open a filehandle FILE to $guestbook
+real
while (<FILE>) {
chomp; # delete any EOL character(s)
$content .= $_; # Add the next line to the previous parts
}
$sth=$dbh->prepare($content);
$sth->execute();
$dbh->disconnect;
In any event, I thought I would try once more - hopefully by posing - if not the "right" question this time, at least a better one...
Q: I need the above code modified to post the results of a form which produces an INSERT INTO string to MySQL. What it is doing instead is successfully retrieving and posting a lone example INSERT string that is sitting on an
HTML page (not surprisingly to those who know (but surprising to me) - because that filehandle - $guestbookreal is pointing to that!) and not the INSERT strings generated by the form....anyhow.
Can somebody please show me what needs to be changed to get the code above to post the form results and not those on the HTML page?
Many thanks in advance,
-Bob
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.