Question: I am very new to stackoverflow. I want to create this form which uploads information to the database. When I click submit it does not get uploaded. I have checked my connections file and that is correct. Code below. Please help.

```
<?php
 include("/connections/db_conx.php");

 if ( isset($_POST['submit']) ) {

$title = mysqli_real_escape_string($_POST['title']);
 $text = mysqli_real_escape_string($_POST['text']);
   $picture = mysqli_real_escape_string($_POST['picture']);

  $sql = "INSERT INTO news  (title, text, picture) VALUES('$title','$text','$picture', now(),now(),now())";

    $query = mysqli_query ($db_conx, $sql);

     echo 'Entered into the news table'; 
     }
     ?>

  <html>

  <head>

 </head>

 <body>

  <table border="0"> 
  <tr>
  <form method="post" action="index.php" id="tech">
  <td>Title</td><td> <input type="text" name="title"></td> </tr>
  <tr> <td>Text</td><td> <textarea rows="4" name="text" cols="50"       name="comment"       form="tech"> </textarea>
       </td> </tr>

 <tr> <td>Picture</td><td> <input type="varchar" name="picture"></td> </tr>

 <tr> <td><input id="button" type="submit" name="submit" value="Submit"></td>

 </tr>
 </form>

 </table> 

</body>

</html>

```

Answer: 
Here is the code you need to use:

```
<?php
    include("/connections/db_conx.php");
    if(isset($_POST['submit'])) {
        $title   = mysqli_real_escape_string($db_conx, $_POST['title']);
        $text    = mysqli_real_escape_string($db_conx, $_POST['text']);
        $picture = mysqli_real_escape_string($db_conx, $_POST['picture']);
        $sql     = "INSERT INTO news (`title`, `text`, `picture`) VALUES('$title','$text','$picture');";
        if(!$result = $db_conx->query($sql)){
            die('There was an error running the query [' . $db_conx->error . ']');
        }
        echo 'Entered into the news table';
    }
?>

<html>
    <head>
    </head>
    <body>
        <form method="post" action="index.php" id="tech">
            <table border="0">
                <tr>
                    <td>Title</td>
                    <td> <input type="text" name="title"></td>
                </tr>
                <tr> 
                    <td>Text</td>
                    <td><textarea rows="4" name="text" cols="50" name="comment" form="tech"> </textarea></td> 
                </tr>
                <tr> 
                    <td>Picture</td>
                    <td> <input type="varchar" name="picture"></td> 
                </tr>
                <tr> 
                    <td><input id="button" type="submit" name="submit" value="Submit"></td>
                </tr>
            </table>
        </form>
    </body>
</html>

```

Your problem is that the `mysqli_real_escape_string()` function requires 2 parameters: the database connection, and the string to escape.

I've also included completely reformatted code, and error checking as well.
Try This :

```
$title = mysqli_real_escape_string($db_conx, $_POST['title']);
$text = mysqli_real_escape_string($db_conx, $_POST['text']);
$picture = mysqli_real_escape_string($db_conx, $_POST['picture']);

$sql = "INSERT INTO news  (title, text, picture) VALUES('$title','$text','$picture')";

$query = mysqli_query ($db_conx, $sql);

if($query){
echo 'Entered into the news table'; // Your Success Message
}
else { 
    echo mysqli_error($db_conx); 
}

```