hi guys,
im using dreamweaver8, do bear with me I'm a newbie.
Im trying to insert multiple rows from a form into the same table in mysql. I mixed some code I saw online with the code generated in dreamweaver and then when I tried running the page I got the error

Parse error: parse error in C:\wamp\www\student information system\student_list_attendance.php on line 292

here is my code//////////

<?php require_once('Connections/dbconnect.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "home.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "admin";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "admin_login.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "student_details")) {

FOREACH($_POST['class_id'] as $row=>$therows)
{
$therows=count($_POST['class_id']);
$student_id=mysql_real_escape_string($_POST['student_id'][$row]);
$class_id=mysql_real_escape_string($_POST['class_id'][$row]);

if (empty($student_id)){} else {

  $insertSQL = sprintf("INSERT INTO attendance (class_id, student_id) VALUES ('".$class_id."','".$student_id."')");
  
   mysql_select_db($database_dbconnect, $dbconnect);
  $Result1 = mysql_query($insertSQL, $dbconnect) or die(mysql_error());
 }}
 
  $insertGoTo = "student_list_attendance.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));

$maxRows_student_list = 5;
$pageNum_student_list = 0;
if (isset($_GET['pageNum_student_list'])) {
  $pageNum_student_list = $_GET['pageNum_student_list'];
}
$startRow_student_list = $pageNum_student_list * $maxRows_student_list;

mysql_select_db($database_dbconnect, $dbconnect);
$query_student_list = "SELECT student_id, First_name, Last_name FROM student ORDER BY student.student_id";
$query_limit_student_list = sprintf("%s LIMIT %d, %d", $query_student_list, $startRow_student_list, $maxRows_student_list);
$student_list = mysql_query($query_limit_student_list, $dbconnect) or die(mysql_error());
$row_student_list = mysql_fetch_assoc($student_list);

if (isset($_GET['totalRows_student_list'])) {
  $totalRows_student_list = $_GET['totalRows_student_list'];
} else {
  $all_student_list = mysql_query($query_student_list);
  $totalRows_student_list = mysql_num_rows($all_student_list);
}
$totalPages_student_list = ceil($totalRows_student_list/$maxRows_student_list)-1;

$colname_admin = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_admin = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_dbconnect, $dbconnect);
$query_admin = sprintf("SELECT admin_Id, first_name FROM `admin` WHERE admin_Id = %s", $colname_admin);
$admin = mysql_query($query_admin, $dbconnect) or die(mysql_error());
$row_admin = mysql_fetch_assoc($admin);
$totalRows_admin = mysql_num_rows($admin);

mysql_select_db($database_dbconnect, $dbconnect);
$query_attendance = "SELECT * FROM attendance";
$attendance = mysql_query($query_attendance, $dbconnect) or die(mysql_error());
$row_attendance = mysql_fetch_assoc($attendance);
$totalRows_attendance = mysql_num_rows($attendance);

$queryString_student_list = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_student_list") == false && 
        stristr($param, "totalRows_student_list") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_student_list = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_student_list = sprintf("&totalRows_student_list=%d%s", $totalRows_student_list, $queryString_student_list);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Attendace </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style2 {color: #614654}
.style3 {color: #FFFFFF}
-->
</style>
</head>
<body>
<div id="container">
  
  <div id="banner"><img src="img/banner.jpg" alt="banner" title="banner" /> </div>
  <div id="bannerb">
  
    <h1>The London College of Business and Information Technology  </h1>
    <h1>&nbsp;</h1>
    <h1><span class="orange">Student Information Site </span></h1>
    <div id="scrolldiv" class="scrolldiv">
	<img src="img/New Picture.jpg" width="210" height="57" /> 
    </div>
  </div>
  <div class="topnav">
    <div id="navcontainer">
      <ul id="navlist">
        <li><a href="home.php">Home</a></li>
<li><a href="student_section.php">Students</a></li>
<li id="active"><a href="admin_section.php">Admin</a></li>
<li><a href="About.html">News/Events</a></li>
<li><a href="http://www.free-css.com/">FAQs</a><a href="http://www.free-css.com/">Contact </a></li>
</ul>
    </div>
    <div class="clear">&nbsp;</div>
  </div>
  
  <div id="sidebar">
    <h1>Student Attendace </h1>
    <div id="menu">
      <ul>
        <li id="active"><a href="manage_students.php">Up to Manage Students </a></li>
        <li><a href="<?php echo $logoutAction ?>">Logout</a></li>
      </ul>
    </div>
	 <div class="clear">&nbsp; </div>
     <div id="scrolldiv">
	  <img src="img/Scrolls.jpg" />
	 </div>
  </div>
  <div id="student_info">
    <h1>Logged in as   <span class="orange"><?php echo $row_admin['first_name']; ?></span></h1>
    <div id="div" class="stpersonal">
	<form action="student_list_attendance.php" method="post" name="class_id_value">
	<input name="class_id" type="text" size="5" maxlength="2" />
	<input name="submit_class_id" type="button" value="GO" />
	</form>
	
	<form action="<?php echo $editFormAction; ?>" id="student_details" name="student_details" method="POST">
     
	  <fieldset>
      <table width="100%" border="0">
        <tr bgcolor="#FF6600">
          <td><span class="style3"> ID No. </span></td>
          <td><span class="style3">First Name </span></td>
          <td colspan="4"><span class="style3">Last Name </span><span class="style3"></span><span class="style3"></span></td>
          </tr>
        <?php do { ?>
          <tr>
            <td><input name="student_id" type="text"  value="<?php echo $row_student_list['student_id']; ?>"/></td>
            <td><?php echo $row_student_list['First_name']; ?></td>
            <td><?php echo $row_student_list['Last_name']; ?></td>
            <td><a href="update_ attendance.php?studentid=<?php echo $row_student_list['student_id' ] ;?>">update</a></td>
            <td><a href="View_attendace_admin.php?studentid=<?php echo $row_student_list['student_id' ] ;?>">View</a></td>
            <td><input name="class_id" type="hidden" id="class_id" value="<?php echo $POST['class_id'];?>" /></td>
          </tr>
          <?php } while ($row_student_list = mysql_fetch_assoc($student_list)); ?>
      </table>
      </fieldset>
      
      <input type="hidden" name="MM_insert" value="student_details">
	  <input type="submit" name="Submit" value="Update" />
	</form>
	<p>&nbsp;</p>
	<hr width="100%" />

    <table width="100%" border="0" cellspacing="1px" cellpadding="1px">
      <tr>
        <th width="25" scope="row"><div align="left" class="style2"><a href="<?php printf("%s?pageNum_student_list=%d%s", $currentPage, min($totalPages_student_list, $pageNum_student_list + 1), $queryString_student_list); ?>">Next</a></div></th>
        <td width="25"><div align="left" class="style2"><a href="<?php printf("%s?pageNum_student_list=%d%s", $currentPage, max(0, $pageNum_student_list - 1), $queryString_student_list); ?>">Previous</a></div></td>
        <td width="25"><div align="left" class="style2"><a href="<?php printf("%s?pageNum_student_list=%d%s", $currentPage, 0, $queryString_student_list); ?>">First</a></div></td>
        <td width="25"><div align="left" class="style2">
          <a href="<?php printf("%s?pageNum_student_list=%d%s", $currentPage, $totalPages_student_list, $queryString_student_list); ?>">Last</a></div></td>
      </tr>
    </table>
    </div>
  </div>
  <div id="footer"> <a href="http://www.free-css.com/">disclaimer</a> | <a href="mailto:denise@mitchinson.net">terms of use </a> | <a href="http://validator.w3.org/check?uri=referer">privacy notice </a> | <a href="http://jigsaw.w3.org/css-validator">Phone: +44 (0) 7533856123 </a> | &copy; 2010 The College| Design by <a href="http://www.mitchinson.net">Jere M F Limited </a></div>
</div>
</body>
</html>
<?php
mysql_free_result($student_list);

mysql_free_result($admin);

mysql_free_result($attendance);
?>

I'll take guess that there are unmatched php tags somewhere,
Why not group all of the php code together instead of it being all over the place?
Then you would only need one set of tags. I would be easier to figure out too!
The only other php tags might be for "in line" use in the form, that's all.

I don't anyone is going to pour over all of that code to find the needle in your haystack.
I suggest gathering up everything in one place, then you can go about commenting out whole sections until the error goes away. It's going to be a process of elimination.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.