Hi, I just started learning PHP a couple of days ago and right now I'm writing a script to insert tutorials into a database. Everything works fine, except that when someone visits "insert.php" it enters empty fields into the database, while it shouldn't enter anything. And when someone refreshes the page after submitting, the data will be entered again. My HTML form looks like this: [code]<html> <body> <form action="insert.php" method="post"> Title: <input type="text" name="title"><br> Description: <input type="text" name="description"><br> Image: <input type="text" name="image"><br> URL: <input type="text" name="url"><br> <input type="Submit"> </form> </body> </html>[/code] and insert.php looks like this: [code]<html> <head> <title>Data inserted</title> </head> <body> <?php $username="uname"; $password="pword"; $database="tutorials"; $title=$_POST['title']; $description=$_POST['description']; $image=$_POST['image']; $url=$_POST['url']; } mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="INSERT INTO tutorials VALUES('','$title','$description','$image','$url')"; mysql_query($query); mysql_close(); echo "data succesfully inserted into database"; ?> <br> <br> <a href="insert.html">Enter another tutorial?</a> </body> </html>[/code] I figured out that I will probably have to use an IF statement and I got this: [code]if ( $title == "" ) { echo "<meta http-equiv='refresh' content='0; url=error.php'>"; }[/code] But that would only cover the empty ones... :p Some help please?