please help me out, i use isset to check if the index is defined but instead of saving the value of the textbox it stores 0.how shoul i do it? cause if i wont check if the index is defined ,when i only fill out one textbox it will throw an error, but if i fill out all five it works fine. please take a look at y code, the variables in javascript is used for its inout name, the count is for the stop adding of input text when it reach 5 HTML and PHP
<form class="form-horizontal" method= "POST">
<div class="control-group">
    <div class="inc">
        <div class="controls">
            <button style="margin-left: 50px" class="btn btn-info" type="submit" id="append" name="append">
            Add Textbox</button>
            <br>
            <br>
        </div>
    </div>
    <input type="submit" class="btn btn-info" name="submit" value="submit"/> 
</div>
<?php
$host = "localhost";
$dbname = "lala";
$user = "root";
$pass = "";
$conn = new PDO("mysql:host=$host; dbname=$dbname", $user, $pass);
if(isset($_POST['submit'])){
    for($i=1; $i<=5; $i++){
        if(isset($_POST["textbox$i"]) && $_POST["textbox$i"] !=""){ 
        $sasa = $_POST["textbox$i"];            
        $sql="INSERT into sasa (sasa) values('$sasa')";
        echo $sql."<br>";
$q=$conn->query($sql);
            }
    }   
}
?>
javascript;
<script type="text/javascript">
                    jQuery(document).ready( function () {
                        var val = 1;
                        var me = 0;
                        var count = 0;
    $("#append").click( function() {
        if(count<5){
        if(me==0){
            val=1;
            me = me + 1;
            count = count +1;
    $(".inc").append("<div class='controls'><input class='form-control' type='text' name='textbox"+ val +"'  placeholder='textbox"+ val +"'><a href='#' class='remove_this btn btn-danger'>remove</a> <br> <br> </div");
    return false;
        }
        else{
            val = val  + 1;
            me = me + 1;
            count = count +1;
             $(".inc").append("<div class='controls'><input class='form-control' type='text' name='textbox"+ val +"'  placeholder='textbox"+ val +"'><a href='#' class='remove_this btn btn-danger'>remove</a> <br> <br> </div");
    return false;
        }
        }
        else{
        }
    });
jQuery(document).on('click', '.remove_this', function() {
    me = me - 1;
    count = count - 1;
    jQuery(this).parent().remove();
    return false;
    });
});
                            
 
    