I haven't worked with PHP in some years, and I am new to the $POST and $GET function. However, the script below works when I pass a variable, but I get the error message for each of the three variables :
Notice: Use of undefined constant contact - assumed 'contact' in c:\easyphp\www\insertarticle.php on line 9
when I pass variables from the form script "WriteArticle.php" to the script "InsertArticle.php".
Also, the SQL INSERT line does not work with the variables (no data get inserted into the db table), but works if I hardcode the values. What do I do wrong with the variables and why doesn'y mt INSERT command work?
Please see the scripts below:
File: "WriteArticle.php":
<form action="InsertArticle.php" method="post">
Your Name: <input type="text" name = "contact"><br>
Article slug : <input type="text" name = "slug"><br>
Article content : <input type="text" name = "content"><br>
<input type="Submit" value="Add">
</form>
File: "InsertArticle.php"
<?
include("conf.php");
$db = "fv_members";
$contact=$POST[contact];
$slug=$POST[slug];
$content=$_POST[content];
echo "$contact " ;
echo "$slug " ;
echo "$content " ;
$connection = mysql_connect($host,$user,$pass) or die ("db feil");
mysql_select_db($db) or die ("Uanble to select database");
$query="INSERT INTO artikkel (id, name, slug,content, time) VALUES('',$contact,$slug,$content, NOW())";
mysql_query($query);
mysql_close($connection);
?>
Thanks.