Chaotic Jarod has asked for the wisdom of the Perl Monks concerning the following question:
CGI<html> <center><h1><div>Enter the user that you would like to change data for + .</div></h1></center> <form action = "http://127.0.0.1/cgi-bin/change.cgi" method="POST"> <div>Name: <input name="name" size="15"></div> <div>New phone number: <input name="phone" size="15"></div> <div>New on-call day: <input name="day" size="15"></div> <div><input type="submit"></div> </form> </html>
#!/usr/bin/perl -w use CGI qw(standard); use DBI(); use DBD::mysql; use warnings; use diagnostics; my $q = CGI->new; my $name = $q->param('name'); my $number = $q->param('phone'); my $day = $q->param('day'); my $dbh = DBI->connect('dbi:mysql:oncall','webuser','password') or die "Connection Error: $DBI::errstr\n"; my $sth=$dbh->prepare("UPDATE users SET day = ?, phone =? WHERE na +me = ?"); $sth->execute($day,$number,$name); #Disconnecting from database $dbh->disconnect(); print $q->header, $q->h1('you submitted the change!'), $q->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Almost done with project.
by marto (Cardinal) on Jul 18, 2013 at 13:51 UTC | |
|
Re: Almost done with project.
by rjt (Curate) on Jul 18, 2013 at 13:57 UTC | |
by ww (Archbishop) on Jul 18, 2013 at 14:28 UTC | |
by Anonymous Monk on Jul 18, 2013 at 14:55 UTC | |
by rjt (Curate) on Jul 18, 2013 at 14:46 UTC | |
by Chaotic Jarod (Novice) on Jul 18, 2013 at 14:20 UTC | |
by davido (Cardinal) on Jul 18, 2013 at 15:29 UTC | |
|
Re: Almost done with project.
by daxim (Curate) on Jul 18, 2013 at 13:54 UTC |