Possible Duplicate:
PHP $_POST print variable name along with value
I am just wondering how to store $_POST variables in an array.
I have several $_POST variables, as follows:
$_POST['cCode'];
$_POST['sSubject'];
$_POST['lect'];
$_POST['rRoom'];
$_POST['dDay'];
$_POST['sTime'];
$_POST['eTime'];
How can I access them all at the same time using a foreach()
?
I know how to access one, like this:
$data = $_POST['cCode'];
foreach($data as $code){
echo $code;
}
Then I want to save it into mysql..
Here is my database:
DROP TABLE IF EXISTS `ocs_database`.`schedule`;
CREATE TABLE `ocs_database`.`schedule` (
`schedID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`courseCode` varchar(30) NOT NULL,
`subjectName` varchar(45) NOT NULL,
`roomName` varchar(45) NOT NULL,
`lecturerName` varchar(45) NOT NULL,
`day` varchar(45) NOT NULL,
`startTime` varchar(45) NOT NULL,
`endTime` varchar(45) NOT NULL,
PRIMARY KEY (`schedID`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=latin1;