php mysql simple form help
whats wrong with my code ?? every time i refreh my page a new field is created in database 'example' i want my code to create new field in database only if something is insert in text field
here is my code
<?php
$name=$_POST['name'];
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("quotes") or die(mysql_error());
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="name">
<input type="submit" value="GO">
</form>
<?php
mysql_query ("INSERT INTO example (name) VALUES('$name')") or die(mysql_error());
$result = mysql_query("SELECT * FROM example")
or die(mysql_error());
$row = mysql_fetch_array( $result );
echo "Name: ".$row['name'];
?>
also when i am fetching all the records from databse , the ouput showing nothing on the screen :(
please help