lundi 20 août 2018

Php - Textbox values to array is replacing

I'm trying have a array which store the text box values, but my problem is whenever I run my code the first text is always being replace when I add another text, this "another text" will remain until I add a third text. And so, this process will repeat and repeat annndd repeat.

Please tell me wath I'am missing.

<body>

<?php
    $server_name="localhost";
    $username="root";
    $password="";
    $database="mabangis";
    $connection=mysqli_connect($server_name,$username,$password,$database) or die('not connect');

    $final_value1=();

    if(isset($_POST['insert'])) {
        $arraytextbox_value=$_POST['array'];
        $items = array();
        foreach($arraytextbox_value as $final_value) { $final_value1[]="$final_value<br>"; }

            echo ($items);
    }
?>

    <form method="POST" action="Prac-1.php">
        Name: <input type="text" name="array[]">
        <button type="add" name="insert">Add</button>
        <button type="save">Save</button>
    </form>
</body>




Aucun commentaire:

Enregistrer un commentaire