Yikes I did that and got this:
4i dotCom - New Client Entry
Industry
Warning: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /opt/apache/htdocs/newclient.php on line 35
Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /opt/apache/htdocs/newclient.php on line 35
Warning: MySQL: A link to the server could not be established in /opt/apache/htdocs/newclient.php on line 35
Prior to adding this PHP script and saving as PHP, I guess the HTML page relied on the results page to connect. That page only has an insert statement to the Clients table.
Here is top part of entry page with 35+ lines and further down the results page.
<head>
<title>4i dotCom - New Client Entry</title>
<STYLE TYPE="text/css">
H1 {
font-weight: bold;
font-size: 12pt;
line-height: 12pt;
font-family: verdana;
font-variant: normal;
font-style: normal;
}
BODY {
color: black;
background-color: white;
background-image:src="manual/images/4i_Logo.gif";
background-repeat: no-repeat;
font-family:verdana;
font-variant: normal;
font-style: normal;
font-weight: normal;
font-size: 10pt;
line-height: 11pt;
}
</STYLE>
</head>
<align="left"><IMG SRC="manual/images/4i_Logo.gif" ALT="4i Logo" BORDER=0>
<body>
<h1>4i dotCom - New Client Entry</h1>
<form action="http://localhost/insert_client.php" method="post">
<table border=0 font-size=8>
<tr><td><font=8>Industry</font></td><td>
<?
$results = mysql_query("SELECT IndName FROM Industry ORDER BY IndName");
echo '<select name="IndName">';
while( list($IndName) = mysql_fetch_row($results)){
echo "<option value='$IndName'>$Ind Name";
}
echo "</select>";
?>
HERE IS RESULTS PAGE
<head>
<title>4i dotCom Entry Results</title>
</head>
<body>
<h1>4i dotCom Entry Results</h1>
<?
if (!$ClientName || !$ClientStNo || !$ClientStName || !$ClientPostCode || !$AreaCode || !$MainPhone || !$MainFax || !$MainEmail || !$MainContact || !$ConsultantID)
{
echo "You have not entered all the required details.<br>"
."Please go back and try again.";
exit;
}
$ClientID = addslashes($ClientID);
$ClientName = addslashes($ClientName);
$ClientBldgName = addslashes($ClientBldgName);
$ClientStNo = addslashes($ClientStNo);
$ClientStName = addslashes($ClientStName);
$ClientStType = addslashes($ClientStType);
$ClientDistName = addslashes($ClientDistName);
$ClientCityName = addslashes($ClientCityName);
$ClientPostCode = addslashes($ClientPostCode);
$ClientCountry = addslashes($ClientCountry);
$AreaCode = addslashes($AreaCode);
$MainPhone = doubleval($MainPhone);
$MainFax = doubleval($MainFax);
$MainEmail = addslashes($MainEmail);
$MainContact = addslashes($MainContact);
$Comments = addslashes($Comments);
$MainContact = addslashes($MainContact);
$ConsultantID = doubleval($ConsultantID);
$db = @mysql_pconnect("localhost.localdomain:3306", "root", "password");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("4i_dotCom");
$query = "insert into Clients (ClientID, ClientName, ClientBldgName, ClientStNo, ClientStName,
ClientDistName, ClientCityName, ClientPostCode, ClientCountry, Industry, AreaCode, MainPhone, MainFax,
MainEmail, MainContact, Comments, ConsultantID, ClientStType) values
('".ClientID."', '".$ClientName."', '".$ClientBldgName."', '".$ClientStNo."', '".$ClientStName."',
'".$ClientDistName."', '".$ClientCityName."', '".$ClientPostCode."', '".$ClientCountry."',
'".$Industry."', '".$AreaCode."', '".$MainPhone."', '".$MainFax."', '".$MainEmail."', '".$MainContact."', '".$Comments."', '".$ConsultantID."', '".ClientStType."')";
$result = mysql_query($query) or die("Error: ".mysql_error());
if ($result)
echo mysql_affected_rows()." client inserted into database.";
?>
</body>