index.php:
<html>
<head>
<meta content="text/html; charset=UTF-8" />
<title>temp db</title>
</head>
<body>
<form name="add_article" action="add_article.php" method="get">
<input type="text" name="article_name" />
<input type="text" name="article_theme" /><br />
<input type="button" value="+" id="add_article" /><br />
<input type="submit" /><br />
</form>
</body>
</html>
add_article.php:
<?php
function add_article($name, $theme){
$query = "INSERT INTO
`articles` (`article_name`, `article_theme`)
VALUES
('$name', '$theme')";
mysql_query($query)
or trigger_error(mysql_errno() . ' ' .mysql_error());
}
print_r($_REQUEST);
$name = $_GET['article_name'];
$author = $_GET['article_theme'];
$dbhost = "localhost"; // Имя хоста БД
$dbusername = "user"; // Пользователь БД
$dbpass = "password"; // Пароль к базе
$dbname = "hl"; // Имя базы
$dbconnect = mysql_connect ($dbhost, $dbusername, $dbpass);
mysql_select_db($dbname);
add_article($name, $author);
mysql_close($dbconnect);
//header("Location:index.php");
?>
Заранее спасибо