# PHP - insert into database

**URL:** <https://forum.kirupa.com/t/php-insert-into-database/287740>\
**Category:** Uncategorized\
**Created:** [May 5, 2009, 7:05pm UTC](https://forum.kirupa.com/t/php-insert-into-database/287740 "2009-05-05T19:05:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RubenDoliveira](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rubendoliveira/32/3905_2.png) [@RubenDoliveira](https://forum.kirupa.com/u/RubenDoliveira)\
**Post date:** [May 5, 2009, 7:05pm UTC](https://forum.kirupa.com/t/php-insert-into-database/287740/1 "2009-05-05T19:05:20Z")

</div>

Hi everyone,

I made a simple form that is supposed to insert members on DB.

```php

 <form method="POST" action="script.php">
    
Name
<input name="Name" type="text" size="50" maxlength="50" name="user" />
        
            
Email
<input name="Email" type="text" size="50" maxlength="50" name="email"/>
            
<input type="submit" name="submit" id="submit" value="Submit">
<input type="reset" value="Limpar">
            
</form>

```

Now, on my script.php page I have the rest of the code:

```php

<?php
include ("connection.php");

    if(isset($_POST['submit'])) {
    
    $user = $_POST['user'];
    $email = $_POST['email'];

$sql="INSERT INTO clients (name, email) VALUES ('$name','$email')";
            
            $result = mysql_query($sql);
            
            if(!$result) {
            {
                 die('Error: ' . mysql_error());
                 
            } else {
            
            echo "<p>Done!.</p>";
            
            }
        
        mysql_close($connection);
    }

?>

```

Everything is in order and the folder structure is correct, however, it seems that it never enters the script.php page, I tried flags and got nothing.

Any thoughts?

Thanks in advance.
