Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------
- INDEX1.HTML
- -------------
- <!DOCTYPE html>
- <html>
- <head>
- <title> HTML Forms </title>
- </head>
- <body>
- <H1> HTML Forms</h1>
- <form id="form-id" action="/cgi-bin/DBconnect.pl" method="post">
- <button type="submit">Connect to DB</button>
- </form>
- </body>
- </html>
- ---------------
- DBconnect.pl (Put into CGI-bin, change permissions to 0755)
- ---------------
- #!/usr/bin/perl -w
- use strict;
- use warnings;
- use DBI;
- use CGI qw(:standard);
- use CGI::Carp qw(fatalsToBrowser);
- print "Content-type: text/html\n\n";
- my $driver = "mysql";
- my $database = "erwilban_Contact_Information";
- my $dsn = "DBI:$driver:$database:localhost";
- my $userid = "erwilban_contact";
- my $password = "password";
- my $dbh = DBI->connect($dsn, $userid, $password) or die $DBI::errstr;
- $dbh->disconnect();
- print "DB Connection Successful";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement