How do I get the HTML text fields to complete a query
- how much HTML do you know?
- can you create a HTML <form> with <input> fields?
- as far as i know you will need a web server to process a <form> do you have a web server and do you have permissions to write to the cgi-bin libraries?
To write and process forms. I still use
CGI but that is being depreciated and some may suggest
CGI::Simple to write and process forms.
run the query, SQL I think
I mostly use DBD::SQLite a subset of DBI, but at times use DBD::mysql.
All the DBI routines share the same query model. first you connect
my $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","");
(above xample from
DBD::SQLite)
then you setup.
$sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?");
then you run
$sth->execute( $baz );
while ( @row = $sth->fetchrow_array ) {
print "@row\n";
}
(above example from
DBI)
display results on the same HTML I started with?
Well that isnt quite true, you get some HTML, fill in the form, press the submit button, then you get NEW HTML back. But it will probably be from the same address. For the most part the same cgi code will first construct the page with the empty form, then when you press submit get the input from your browser, execute your sql from the input fields, then construct a page with the results and another form.
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.