Answer the question
In order to leave comments, you need to log in
How to pass input field values to an array?
Good afternoon.
Help adding input field values to php array.
The form:
<form method="post">
<inpute type="text" name="optio">
<inpute type="text" name="optio">
<inpute type="text" name="optio">
</form>
if (isset($_POST['save'])) {
$MassCh[$i]=$_POST['optio'];
}
Но при таком варианте добавляется в массив все и в одну ячейку и это не странно.
for ($i=1; $i<=$valueLine; $i++) {
$MassCh[$i]=$_POST['option'.$i];
}
Answer the question
In order to leave comments, you need to log in
<input type="text" name="field[]">
B $_POST['field']
will already have an array of filled values.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question