I am getting some problems while attempting to connect b .perl with mysql. here's the bond.perl code

<?php
$db_host =$_POST['localhost'];
$db_user =$_POST['root'];
$db_password = "";
$db_name = "prtcl";
?>

which is the page where I really make use of the connection

<?
include("connection.php"); 
?>

...

<?php
$db = mysql_connect($db_host, $db_user, $db_password);
        mysql_select_db($db_name, $db);
            if (!$db)
              {
              die('Could not connect: ' . mysql_error());
              }
mysql_close($db);             
?>

<body>

...

that is what I recieve after i attempt to load it ( line 29 is that one:

$db = mysql_connect($db_host, $db_user, $db_password)

)

Notice: Undefined variable: db_host in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

Notice: Undefined variable: db_user in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

Notice: Undefined variable: db_password in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

Warning: mysql_connect() [function.mysql-connect]: [2002] A connection attempt unsuccessful since the connected party didn't (attempting to connect via tcp://localhost:3306) in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

Warning: mysql_connect() [function.mysql-connect]: An association attempt unsuccessful since the connected party didn't correctly respond following a time period, or established connection unsuccessful because connected host has unsuccessful to reply. in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

Fatal error: Maximum execution duration of thirty seconds exceeded in C:Program Files (x86)EasyPHP-5.3.2wwwprtclindex.php online 29

as you can tell I am using EasyPHP and, because this very code accustomed to work before (having a different db, while using the by hand set up apache/mysql), might be the reason? Other infos: I made the db using phpmyadmin and that i have win7

thanks

I'd discover why the $db_host variable isn't getting defined. That could be an issue with your form input. Determine the title of this input area is really 'localhost'. Also, as Mark Baker pointed out above, you want to complete some input cleansing to protect against sql injection attacks. Plus, can there be any reason you cannot hardcode the db host info right into a configuration file?

Don't ever take your db qualifications from $_POST without validation. This really is such a dreadful idea which is what's leading to your errors, because these secrets aren't being defined in $_POST, but they may be and also the results might be disastrous!

try putting this in connect.php

$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_name = "prtcl";

$db = mysql_connect($db_host, $db_user, $db_password);
mysql_select_db($db_name, $db);
if(!$db) {
    die('Could not connect: ' . mysql_error());
}

then inside your other pages use:

require_once("path/to/connect.php");

// ... whatever else you do on this page...