Hi, I'm just starting out with php and mysql.I've successfully created my database, tables, php connection file, and forms to update records so all in all good start.My connection.php looks like this:
<?php$db_host = "localhost";$db_username = "dummy";$db_pass = "dummy1234";$db_use = "dummy";$con = mysql_connect("$db_host","$db_username","$db_pass");if (!$con) { die('Could not connect to mysql: ' . mysql_error()); } echo "Connected to mysql";?><br /><?phpmysql_select_db("$db_use", $con);echo "Connected to database: "."$db_use";?>
I'm trying to create a form that submits variables e.g. $db_host = $_POST['host'];$db_username = $_POST['username']; $db_pass = $_POST['pass']; $db_use = $_POST['db']; so that the user can open different databases on different hosts.But when the php form is parsed I receive the undefined index error due to the variables not being set initially (I think!).Can anyone offer any advice?