BluGeni has asked for the wisdom of the Perl Monks concerning the following question:

i am new to databases here and i have page in which I want variables i have set sent to a database. I know how to connect to the database i want and everything and the database table set up but not sure how to send it. for example here is part of my code and i want "mileage" sent to the database
<TR> <TD width="220" align="right" bgcolor="#E1E1FF"> Mileage: <input type="text" SIZE="9" NAME="mileage" onkeypress="return +isNumberKey(event)" onkeyup="this.value=add_commas(this.value);" /></ +TD> <TD width="145" align="left" bgcolor="#E1E1FF">&nbsp;</TD> </TR>

Replies are listed 'Best First'.
Re: sending data to a database
by marto (Cardinal) on May 24, 2012 at 14:30 UTC

    First ensure you're safely reading parameters via CGI. I advise working through Ovid's CGI Course if you don't have experience in this. For the database part, install DBI and the driver the database product you are using (e.g. DBD::Oracle for Oracle databases]). The tutorial Databases made easy is a good starting point for learning the basics.

Re: sending data to a database
by choroba (Cardinal) on May 24, 2012 at 14:29 UTC
    You should do something along these lines:
    my $insert_mileage = $db->prepare('insert into mileage values(?)'); $insert_mileage->execute(param('mileage'));
Re: sending data to a database
by Anonymous Monk on May 24, 2012 at 17:19 UTC
    Essentially, what you are asking for is ... a complete write-up of how database driven web sites work. Since the Internet is stuffed with such things, start there. Not here.