fundean
Dec 18th, 2006, 05:56 PM
<?php
$db_host = "mysql";
$db_user = "lefteh";
$db_pwd = "1234";
$db_name = "MyDB";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<html>
<head>
<title>My first MySQL form submission</title>
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
Name: <input type="text" name="name"><br>
Favorite Color: <input type="text" name="color"><br>
<input type="submit" name="submit" value="Submit!">
</form>
<?php
} else {
$name = $_POST['name'];
$color = $_POST['color'];
mysql_query("INSERT INTO `colors` (name, favoriteColor) VALUES
('$name', '$color')");
echo "Success! Your favourite colour has been added!";
}
?>
</body>
</html>
When I submit the form using the values "fundean" and "blue" I get the following errors:
"Error: method not allowed"
HELP !!!!
fundean
$db_host = "mysql";
$db_user = "lefteh";
$db_pwd = "1234";
$db_name = "MyDB";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>
<html>
<head>
<title>My first MySQL form submission</title>
</head>
<body>
<?php
if (!isset($_POST['submit'])) {
?>
<form action="" method="post">
Name: <input type="text" name="name"><br>
Favorite Color: <input type="text" name="color"><br>
<input type="submit" name="submit" value="Submit!">
</form>
<?php
} else {
$name = $_POST['name'];
$color = $_POST['color'];
mysql_query("INSERT INTO `colors` (name, favoriteColor) VALUES
('$name', '$color')");
echo "Success! Your favourite colour has been added!";
}
?>
</body>
</html>
When I submit the form using the values "fundean" and "blue" I get the following errors:
"Error: method not allowed"
HELP !!!!
fundean