Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Simplest thing first. You have an error, you can't use</p> <pre><code>array_push($schedules,$_POST['txtSchedule'.'$d']); </code></pre> <p>You must use DOUBLE QUOTES on the $d (single quotes won't evaluate d, it will literally read "txtSchedule$d" with a dollar sign, and not actually 0, 1,..., n)</p> <pre><code>array_push($schedules,$_POST['txtSchedule'."$d"]); //or no quotes at all array_push($schedules,$_POST['txtSchedule'.$d]); </code></pre> <p>(that may sovlve your problems)</p> <hr> <p>But now let's get to how to make an array available to the $_POST object in the processing page via form naming conventions</p> <p>You're not using array syntax, but you are oh-so close. In PHP, whatever is submitted needs to be of an expected format, and iterating txtSchedule0, txtSchedule1, ...txtScheduleN is not an Array(), but $_POST[] is an array that contains each (given what you've named your input fields, which is missing 1 small thing - square brackets).</p> <p>What you need to do is be naming your inputs as an array is the array name followed by square brackets (arrayName[]), here is how you create an input array of the name txtSchedule (that way when you print_r($_POST['txtSchedule']) you get an Array())</p> <pre><code>&lt;input name="txtSchedule[&lt;?php echo $i;?&gt;]" type="text" size="30"/&gt; </code></pre> <p>I had the same issue when I started in PHP, you were forgetting the square brackets around [&lt;?php echo $i;?>]</p> <p>Just make sure that if you want to do an iteration over an array of inputs:</p> <pre><code>for($i=0; $i &lt; count($_POST['txtSchedule']); $i++){ echo "They entered " . $_POST['txtSchedule'][$i] . " in the $i" . "th position"; } </code></pre> <p>... you have used the &lt;input name="arrayName[$i]"> sytax, or even more simply &lt;input name="arrayName[]"> for it to auto-magically generate an array on submit in the order the inputs were in the HTML page. The naming convention is so important, and since you have it wrong (you used arrayName0, arrayName1, ... arrayNameN instead of arrayName[0], arrayName[1], ... arrayName[n]), it will never be available to you as an array.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload