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

<formmethod="POST"><inputtype="text"name="myinput[]"value="some value"/><br/><inputtype="text"name="myinput[]"value="second value"/><br/><inputtype="text"name="myinput[]"value="another value"/><br/><inputtype="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?"