Quote Originally Posted by prouton View Post
There are no html commands/structure being sent back to the browser from submit.php.

Format your VALUES like this: '{$_POST[field1]}','{$_POST[field2]}'
Tried it, but no luck.

Here's are the latest codes:

index.htm
Code:
<html>
<head>
<title>Welcome</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<form name="form1" method="post" action="submit.php">
Name<input type="text" name="name" /><br />
Age<input type="text" name="age" /><br />
<input type="submit" value="Add" />
</form>
</body>
</html>
submit.php
Code:
<?php
print_r($_POST);

$connect = mysql_connect("localhost","C:\wamp\","");

if (!$connect)
{
die("Couldnt connect" . mysql_error());
}

mysql_select_db("db", $connect);

$sql = "INSERT INTO table (name, password) VALUES ('{$_POST[name]}','{$_POST[age]}')";

echo $sql;

if (!mysql_query($sql, $connect))
{
die("Error: " . mysql_error());
}

echo "1 record added";

mysql_close($connect);
?>