Skip to content Skip to sidebar Skip to footer

What Is The Standard Way To Manage Multiple Similar Inputs In A HTML/PHP Form?

I have a single HTML form that allows users to insert or update multiple rows in a database with a single submission. However, I don't know what the 'correct' or industry standard

Solution 1:

HTML

<form method="POST">
    <input type="text" name="myinput[]" value="some value"/><br/>
    <input type="text" name="myinput[]" value="second value"/><br/>
    <input type="text" name="myinput[]" value="another value"/><br/>
    <input type="submit"/>
</form>

PHP

<?
foreach ($_POST["myinput"] as $value) {
    echo "myinput : " . $value . "<br/>";
}
?>

Post a Comment for "What Is The Standard Way To Manage Multiple Similar Inputs In A HTML/PHP Form?"