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!
I'm a complete newb in PHP/MySQL/Apache and I'm volunteering for a non-profit organization, I had expected to spend a couple of hours on the site and I'm about 15 hours in already.
I'm trying to create an attendance sheet and post it to an event table. The code to create the 'form' is:
<?php
$connect = mysql_connect("localhost","un","pw");
if (!$connect)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("cha", $connect);
$type = array($_POST["pkid"]);
foreach($type as $key => $value){
echo $key.": ".$value;
}
?>
This only gives me the following 0:2
It doesn't give me the array.
What I really need to do is create a record within the event table for each child that was at the lesson. I can't even seem to view the $_POST array let alone insert it into mySQL. I'm a wiz at SQL but this PHP stuff isn't my bag.
I truly appreciate any help and this functionality for the np-org I'm volunteering for will save massive amounts of time.
I'm not sure what those values are. I would expect the list of pkid's so 1:2:3:4:5:6... as there are only 45 children in the database.
I also need to insert other values i.e. whether or not they attended (yes or no), what program they're in will be a hidden value passed from the form as well as the site and lesson code.
Doh!!! I called myself a sql wiz and it was the SQL that was bad. I didn't set the defaults. Now my only question is how can I place multiple post values in the array. Again, any help is much appreciated.