store input in an array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kates
Forum Newbie
Posts: 2
Joined: Mon Mar 14, 2011 8:13 pm

store input in an array

Post 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.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: store input in an array

Post 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
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
kates
Forum Newbie
Posts: 2
Joined: Mon Mar 14, 2011 8:13 pm

Re: store input in an array

Post by kates »

thanks, i'm gonna try this.
how about keyboard controls?
Post Reply