Reputation: 343
I would like to submit multiple ROWS of field columns using an HTML form with the only difference being the corresponding server side identifier.
Pseudo:
ID(257) -> Name, Color, Price
ID(415) -> Name, Color, Price
I prefer NOT to:
Thanks
Upvotes: 0
Views: 49
Reputation: 6323
You can use the same input name when attaching a [] to it, in PHP this will result in an array on submission:
<?php
print_r($_POST);
?>
<form method="post">
<input type="text" name="name[257]">
<input type="text" name="name[415]">
<input type="submit">
</form>
Result:
Array
(
[name] => Array
(
[257] => first field
[415] => second field
)
)
Upvotes: 1
Reputation: 219804
If you're using PHP as your server side language this is easy. Just name your fields with brackets which is array syntax in PHP:
Pseudo code:
name[1] = 'Name, Color, Price'
name[2] = 'Name, Color, Price'
Upvotes: 0