Page 1 of 1

store input in an array

Posted: Mon Mar 14, 2011 9:24 pm
by kates
hi everyone, just a new member of this group.

well, first of all i'm just a beginner here in php/mysql so have patience with me.

i'm doing a program (an encoding system actually) where the user encodes the grades of a students in secondary level.
what i wanted to ask is :
1. how can i store all the inputs in an array?
example:
<?php
for (i=1;i=array[];i++) {?>
grade <input type= "text" name="grade">
subject <input type= "text" name="subject">
}

2. how to control keyboard when keypressed?
for example: i pressed the F6 button then it will generate a message box to save your file yes/no/cancel.


thanks in advance.

Re: store input in an array

Posted: Tue Mar 15, 2011 11:41 am
by social_experiment

Code: Select all

<?php
 $gradeArray[] = $_POST['grade'];
 $subjectArray[] = $_POST['subject'];
?>
That creates 2 arrays, $gradeArray & $subjectArray each containing the respective values. Hth

Re: store input in an array

Posted: Tue Mar 15, 2011 7:45 pm
by kates
thanks, i'm gonna try this.
how about keyboard controls?