Im trying to make a form with Laravel that send two sets of data. my form is like this.
<form>
<fieldset method="POST" action"some url">
<label for="nameField">Name</label>
<input type="text" id="nameField" name="nameField">
<label for="phoneField">Name</label>
<input type="text" id="phoneField" name="phoneField">
<input class="button-primary" type="submit" value="Send">
</fieldset>
</form>
the first in put nameField will save to the table "names". the phoneField will save to another table "phones". Ok! the problem is I want to let user make as many phoneField as they want (with Javascript of course). so i think the best way is i save nameField like this:
Name::create([ "name" => request("nameField")]);
but how about phoneField? how to save them? users can make about 10 field or more. is there any way to group the phoneFields as any array and send the array with request HTTP?
You can send group of phoneField. Use array for phoneField
And in your controller