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 have a form that is a list populated by every student name, course name, etc. and a checkbox from a database. I want to be able to check selected records in the list, then perform an action on the selected records upon POST. I understand that the result I get from POST is a multidimensional array, but I can't figure out how to extract the records. I am posting an abreviated version of the code below. I think the form is OK. It's extracting the POST data that is driving me nuts. Thanks for any thoughts.
double check your <?php and ?> tags.. your missing one.
This should not have a space between $_POST and ['delete_student']
[delete_student] must also use ' ' so it would be ['delete_student'] as well as $d[student_id] requires the ' ' too.
if ($_POST['submit']){
foreach($_POST['delete_student'] as $key => $value) {
echo $value;
echo $_POST['student_id'][$key];
echo $_POST['course_id'][$key];
}
}
//or just do
echo '<pre>'; print_r($_POST); echo '</pre>';
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.