Below is a table generated by DW for displaying a table of all subjects in a MySQL database. I'm totally new to php and would be grateful for any assistance on how the table could be displayed based on the subject checkbox (line 87).


Code:
<?php require_once('Connections/Education.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
mysql_select_db($database_Education, $Education);
$query_rsMath = "SELECT * FROM maths ORDER BY Grade ASC";
$rsMath = mysql_query($query_rsMath, $Education) or die(mysql_error());
$row_rsMath = mysql_fetch_assoc($rsMath);
$totalRows_rsMath = mysql_num_rows($rsMath);
mysql_select_db($database_Education, $Education);
$query_Recordset2 = "SELECT Grade, Topic FROM maths WHERE Subject = 'English' ORDER BY Subject ASC";
$Recordset2 = mysql_query($query_Recordset2, $Education) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if (isset($_POST['english']))
{
}
?>
<?php echo "Education Portal" ?>
<form id="form1" name="form1" method="post" action="">
<p>
<input type="checkbox" name="english" id="english" />
English
</p>
<p>
<input type="checkbox" name="science" id="science" />
Science</p>
<p>
<input type="checkbox" name="maths" id="maths" />
Mathematics</p>
<p>
<input type="checkbox" name="malay" id="malay" />
Bahasa Malaysia</p>
<p>
<input type="submit" name="submit" id="submit" value="Submit" />
</p>
</form>
<p> </p>
<table border="2">
<tr>
<td>Category</td>
<td>Subject</td>
<td>Grade</td>
<td>Topic</td>
<td>Date</td>
<td>Name</td>
<td>Exam Set</td>
<td>Author</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo "<img src='{$row_rsMath['Image']}' width=50 height=50" ?></td>
<td><?php echo $row_rsMath['Subject']; ?></td>
<td><?php echo $row_rsMath['Grade']; ?></td>
<td><?php echo $row_rsMath['Topic']; ?></td>
<td><?php echo $row_rsMath['Date']; ?></td>
<td><?php echo "<a href='{$row_rsMath['Link']}'>{$row_rsMath['Link']} </a>" ?> </td>
<td><?php echo $row_rsMath['Set']; ?></td>
<td><?php echo $row_rsMath['Author']; ?></td>
</tr>
<?php } while ($row_rsMath = mysql_fetch_assoc($rsMath)); ?>
</table>
<table border="2">
</table>
</body>
</html>
<?php
mysql_free_result($rsMath);
mysql_free_result($Recordset2);
?>
Comment