Help with insert data

Iam a newbie using a localhost with this simple programme



<html>
<body>
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db("--");
$name=isset($_POST["name"]);
$sql="INSERT INTO name SET name='" . mysql_real_escape_string($name) . "' 
 
 
 
;
";

if (@mysql_query($sql)){
    echo 'new author added';}
    else {
       ' erroe adding new author '.mysql_error();
    }


?>
<form action ="post.php" metod="post"/>
<input type='text' name='name' /><br /><br />
<input type='submit' value="GO"/>
</form>


</body>
</html>


it works but when i checked the data in my database i didnt get any thing just data field is blank in name.

thank you:D

HI
isset($_POST[‘name’]) will produce 1 if the value is available. Also you have set your database name as “–”.
I think you are trying to do this.


<html>
<body>



if(isset($_POST['Submit'])){
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_select_db("DATABASENAME");
echo $name=isset($_POST["name"]) ? $_POST['name'] : "";
$sql="INSERT INTO name SET name='" . $name . "'"; 

if (@mysql_query($sql)){
    echo 'new author added';}
    else {
       ' erroe adding new author '.mysql_error();
    }
}


<form action ="post.php" method="post"/>
<input type='text' name='name' /><br /><br />
<input type='submit' name='Submit' value="GO"/>
</form>
</body>
</html>