Jump to content

xenolith05

Members
  • Posts

    3
  • Joined

  • Last visited

xenolith05's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Sorry i need to be clearer. The form and connection work ok but php complains about the empty variables when the doc loads. This is not a problem if error reporting is switched off.I'll go away and have another look at isset (still learning!). I thought isset would test as true even if the value is empty but not set as a NULL so I'm not sure how I would use it.I don't need to evaluate when first loaded as the variables should be empty.The errors obviously only show when I set my php to show errors but if turned off everything works as it should so maybe not a problem. Thanks 'Deidre's Dad'!
  2. The variables will be empty until the user submits the form.When the form is submitted the connection works ok, it's just the initial loading of the php page that shows the errors as there is no $_POST data.I'm on a different pc at the moment so do not have the form to hand. Thanks
  3. 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?
×
×
  • Create New...