I have a form like the one below which is posted to processForm.php, and the user can dynamically add more with jQuery.

<input type="text" name="subject[ ]" />
<input type="text" name="grade[ ]" />
<input type="text" name="year[ ]" />

<input type="text" name="subject[ ]" />
<input type="text" name="grade[ ]" />
<input type="text" name="year[ ]" />

<input type="text" name="subject[ ]" />
<input type="text" name="grade[ ]" />
<input type="text" name="year[ ]" />

Please How can i access those arrays from subject[], grade[] and year[] inputs by the user?

The square brackets in PHP denote an array, and so when you perform a var_dump() upon the $_POST array, you'll get something like the following (with dummy data):

array(4) {
  ["subject"]=>
  array(3) {
    [0]=>
    string(1) "a"
    [1]=>
    string(2) "aa"
    [2]=>
    string(3) "aaa"
  }
  ["grade"]=>
  array(3) {
    [0]=>
    string(1) "b"
    [1]=>
    string(2) "bb"
    [2]=>
    string(3) "bbb"
  }
  ["year"]=>
  array(3) {
    [0]=>
    string(1) "c"
    [1]=>
    string(2) "cc"
    [2]=>
    string(3) "ccc"
  }
  ["submit"]=>
  string(6) "Submit"
}

This means you can access the subject, grade, and year arrays via $_POST['subject'], $_POST['grade'], and $_POST['year'] respectively.

try to do something like

<input type="text" name="input[<?= $i ?>]['subject']">
<input type="text" name="input[<?= $i ?>]['grade']">
<input type="text" name="input[<?= $i ?>]['year']">

Using iteration to output the required input boxes would reduce OP's repetition. Though you need to switch your two square brackets around in order to get the same POST data format as in the original post. I'd also advise against quoting keys in HTML, because when dealing with this data in the $_POST array, you must also remember to put quotes onto the array keys (since it's part of their name):

$_POST['\'subject\'']
// or
$_POST["'subject'"]

That also reduces legibility and is just a pain in general to handle.

Thanks to you guys , I got all i need! That's what I think!

Uploading...
Saving...
You have a post draft in progress. Select this bar to resume editing.