Results 1 to 2 of 2

Thread: Dreamweaver to MySQL using PERL script

  1. #1
    Join Date
    Sep 2009

    Dreamweaver to MySQL using PERL script

    Hi, I am a newbie in Dreamweaver and MySQL stuff, perl etc.

    I use Dreamweaver CS3. I have recently created a web form, the typical "contat us" form and I was able to set it up through a CGI script, with hidden buttons that runs the script which was provided by the server. This script sends the contact information to to a specific email in the body of the email. Currently that works, but...

    Instead of doing that, I want that information to be transmitted to a MySQL database and table that I also have created using PHPmyAdmin.

    1st QUESTION: How do I transfer the data to the MySQL table using CGI Perl?

    2nd QUESTION: the other problem I have is that I am not even sure if the script below is Perl code, and if Dreamweaver supports Perl.

    3rd QUESTION: if it is supported by Dreamweaver, would I just copy/paste the script into the code mode?

    I can understand what I am supposed to do by cutting/pasting and replacing, but I am not even sure if its something I should be trying and if its compatible, so I dont want to waste time. PLEASE HELP!!!


    "The script below uses CGI to grab input from a fill-in form; connect to a MySQL Database; and write the fill-in form input to an existing MySQL table. The values that must be changed to reflect your database are marked in red."


    use DBI;

    use CGI ':standard';

    ## grab input from fill-in form:

    my ($id,$username,$email,$address);

    ## store the input from fill-in form into varibles:

    $id = param('id');

    $username = param('username');

    $email = param('email');

    $address = param('address');

    ## connect to mySQL database:

    $DSN = "DBI:mysql:database_name:localhost";

    my $dbh = DBI->connect($DSN, "database_name", "password") || die "Can't Connect";

    ## insert fill-in form input into database:

    my $sel = $dbh->prepare("INSERT INTO table_name VALUES(NULL,?,?,?)");

    $sel->bind_param(1, $username);

    $sel->bind_param(2, $email);

    $sel->bind_param(3, $address);

    $sel->execute() && $sel->finish();


  2. #2
    Join Date
    Oct 2007
    Vienna, Austria
    Hello cuau.

    Firstly, yes, the code you pasted is positively Perl. :-)

    Dreamweaver, as I roughly know, is a tool mainly for webdesign. You need not Dreamweaver to support Perl in any way. The server where your web is hosted must be configured to allow Perl scripting -- it would seem that your host supports CGI. In such a case, there usually is a specific directory where the Perl scripts should go. In the normal case, the directory is /cgi-bin.

    If this is your case, then upload the Perl script there -- and set its "execute" permission, this is important. You would then set your form's "action" attribute to the URL of the script, e.g. http://example.com/cgi-bin/form.pl

    Of course you must first change the script as appropriate to connect to your database, i.e. set up the database name, username and password.

    Hope this helps

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center