Hi All,

Hope everyone had a safe and happy New Year, I am still having trouble
getting an insert data form to work. Below is the code. I was also wondering
if anyone could tell me the PHP Configuration settings necessary to allow a
form to insert data into a MySQL database.

To view this page, http://www.airforcemuseum.com/newentry.htm


<html>
<head>
<title>Test Form Entry Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<h1>Entry Results</h1>
<?
if (!$firstName || !$lastName)
{
 echo "You have not entered the required details.<br>"
  ."Please go back and try again.";
 exit;
}

$firstName = addslashes($firstName);
$lastName = addslashes($lastName);

$dbcnx = @mysql_pconnect("localhost", "username", "password");

if ($db)
{
 echo "ERROR: Could not connect to database. Please try again later,";
 exit;
}
mysql_select_db("testform");
$query = "insert into testform values
  ('".$firstName."', '".$lastName."')";
$result = mysql_query($query);
if ($result)
 echo  mysql_affected_rows()." record inserted into database.";
?>
</body>
</html>


Thanks in advance,
Ed Waite




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to