What's wrong with this PHP?

Permabanned
Joined
22 Apr 2007
Posts
1,805
I've done quite a few of these now but for some reason this one refuses to work.

Its based on a Win2K3 box running IIS6, PHP and MySQL5

Table (called contacts)

68532834ht1.jpg


and here is the code. In order to break this down I'm trying to insert one thing into one field

Code:
<?php
session_start();
if(!$_SESSION['username']) {
       //not logged in. redirect to login page
       header("Location: index.php");
       exit;
}

include("connect.php"); 

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

</head>

<body>
<h1>Client Entry Form</h1>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
<p><label>Title:</label><input type="text" name="title" maxlength="60" /></p>
<p><input type="submit" name="submit" value="Client Details Submit" /></p>
<p><input type="reset" value="Reset Form" name="reset" /></p>
</form>

<?php
} else {

$title = $_POST['title'];

mysql_query("INSERT INTO 'contacts' (title) VALUES ('$title')");
echo "<h2>Thank you</h2>";
}

mysql_close();

?>
</body>
</html>

Help! :(
 
Back
Top Bottom