I'm working on the input-script now, but I keep getting a parse-error on line 8 of process.php (which is the line that starts with "if(empty"))
Can anyone tell me what's wrong?
This is the input-field (form.html)
CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="input" method="post" action="put.php">
<p>
<input name="title" type="text" id="title">
</p>
<p>
<textarea name="text" id="text"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="input" method="post" action="put.php">
<p>
<input name="title" type="text" id="title">
</p>
<p>
<textarea name="text" id="text"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
and this is the php-file that processes the form-data for insertion into the MySQL-table (process.php)
CODE
<?php
/* Connecting, selecting database */
$link = mysql_connect("localhost", "database", "password")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("database") or die("Could not select database");
if(empty($title) || empty($text)) exit("You didn't completely fill in the form!");
// we're presuming here that you used 'title' and 'text' as the names for your form elements
$title = addslashes($title); $text = addslashes($text);
// add slashes to the sent info so no escape characters are around (they'll possibly bust the script)
mysql_query("INSERT INTO my_news (title,text) VALUES ('$title','$text')");
?>
/* Connecting, selecting database */
$link = mysql_connect("localhost", "database", "password")
or die("Could not connect");
print "Connected successfully";
mysql_select_db("database") or die("Could not select database");
if(empty($title) || empty($text)) exit("You didn't completely fill in the form!");
// we're presuming here that you used 'title' and 'text' as the names for your form elements
$title = addslashes($title); $text = addslashes($text);
// add slashes to the sent info so no escape characters are around (they'll possibly bust the script)
mysql_query("INSERT INTO my_news (title,text) VALUES ('$title','$text')");
?>