Sorry, I basically copied what you had in the previous post and reformatted it.
Note that I changed the "table" to "phpwork" in the insert statement and also changed id to Uid (in case this is conflicting with MODx id).
As far as the connection message, the way it was would only show if it does not connect.
Try this version and see if it is any better
<?php
$output ="";
$output .="
<html>
<head>
<title>Form to DB</title>
</head>
<body>";
// check if $_POST['Uid'] is set, if so do the db stuff
if(isset($_POST['Uid'])){
$conn = mysql_connect("localhost", "mydb", "pass")
or die("no connection" .mysql_error());
$db = mysql_select_db("phpwork")
or die("connected" .mysql_error());
if($conn){
$output .="<p>Conn: yes</p>";
}
if($db){
$output .="<p>db: yes</p>";
}
$Uid = $_POST['Uid'];
$username = $_POST['username'];
$password = $_POST['password'];
$query = "INSERT INTO phpwork (id, username, password) VALUES ('$Uid', '$username', '$password')";
if($query){
$output .="<p>Congratulations ".$username.", the form was filled out</p>";
}else{
$output .="<p>An error occured while saving the information</p>";
}
}else{
// show the form
$output .="<p>
<form action='".$PHP_SELF."' method='post'>
Username: <input type='text' name='username'
value=''><br>
Password: <input type='password' name='password'
value=''><br>
id: <input type='text' name='Uid'
value=''><br>
<input type='submit' name='submit' value='Register'>
<input type='reset' value='Clear\">
</form>
</p>";
}
$output .="</body>
</html>
";
echo $output;
?>