I am new to mysql php and I have been struggling to make this simple name entry form work but it has been failing on me by inserting blank entries. I have been looking arround the web for a while but nothing has been helpful.
This is my html form
    <form action="demo.php" method="post"> 
    name:<input type="text" name="input1">
    <br/>
    <input type="submit" value="submit">
    </form>
My php code
    <?php
    define('db_name', 'demo');
    define('db_user', 'root');
    define('db_password', 'password');
    define('db_host', 'localhost');
    $link = mysql_connect (db_host, db_user, db_password);
    if (!$link) {
       die('could not connect: '. mysql_error());
    }
    $db_selected = mysql_select_db(db_name, $link);
    if (!$db_selected) {
    die('can\'t use' . db_name . ': ' . mysql_error());
    }
    $value = $_post['input1'];
    $sql = "insert into demo (name) values ('$value')";
    if (!mysql_query($sql)) {
      die('Error: ' . mysql_error());
    }
    mysql_close();
    ?>
Mysql table
+-------+-------------+------+-----+---------+----------------+
| Field | Type        | Null | Key | Default | Extra          |
+-------+-------------+------+-----+---------+----------------+
| id    | int(11)     | NO   | PRI | NULL    | auto_increment |
| name  | varchar(30) | YES  |     | NULL    |                |
+-------+-------------+------+-----+---------+----------------+
 
     
     
     
    