SitePoint Member
Drop down list error
Hi
DWMX/PHP/MySql
I have a test page with two dynamic drop down lists, populated from a
database but I get this from the results page:
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/home/www/learningcurve/course_search_results.php on line 11
This is all DWMX code, no added hand coding and as I am a PHP novice, I have
no idea what is wrong.
http://www.learningcurve.org.uk/course_search.php
Here is the search results page code
<?php require_once('Connections/conn_*****.php'); ?>
<?php
$maxRows_rs_course_search = 10;
$pageNum_rs_course_search = 0;
if (isset($HTTP_GET_VARS['pageNum_rs_course_search'])) {
$pageNum_rs_course_search = $HTTP_GET_VARS['pageNum_rs_course_search'];
}
$startRow_rs_course_search = $pageNum_rs_course_search *
$maxRows_rs_course_search;
$location_rs_course_search = "1";
if (isset(Request("location"))) {
$location_rs_course_search = (get_magic_quotes_gpc()) ?
Request("location") : addslashes(Request("location"));
}
$heading_rs_course_search = "2";
if (isset(Request("heading"))) {
$heading_rs_course_search = (get_magic_quotes_gpc()) ? Request("heading")
: addslashes(Request("heading"));
}
mysql_select_db($database_conn_lcgeneral, $conn_*****);
$query_rs_course_search = sprintf("SELECT * FROM courses WHERE (location_id
= %s OR location_id = 0) AND (heading_id = %s OR heading_id = 0)",
$location_rs_course_search,$heading_rs_course_search);
$query_limit_rs_course_search = sprintf("%s LIMIT %d, %d",
$query_rs_course_search, $startRow_rs_course_search,
$maxRows_rs_course_search);
$rs_course_search = mysql_query($query_limit_rs_course_search, $conn_*****.)
or die(mysql_error());
$row_rs_course_search = mysql_fetch_assoc($rs_course_search);
if (isset($HTTP_GET_VARS['totalRows_rs_course_search'])) {
$totalRows_rs_course_search =
$HTTP_GET_VARS['totalRows_rs_course_search'];
} else {
$all_rs_course_search = mysql_query($query_rs_course_search);
$totalRows_rs_course_search = mysql_num_rows($all_rs_course_search);
}
$totalPages_rs_course_search =
ceil($totalRows_rs_course_search/$maxRows_rs_course_search)-1;
$colname_rs_location = "1";
if (isset($HTTP_GET_VARS['id'])) {
$colname_rs_location = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] :
addslashes($HTTP_GET_VARS['id']);
}
mysql_select_db($database_conn_*****, $conn_*****);
$query_rs_location = sprintf("SELECT * FROM location WHERE id = %s ORDER BY
location ASC", $colname_rs_location);
$rs_location = mysql_query($query_rs_location, $conn_*****.) or
die(mysql_error());
$row_rs_location = mysql_fetch_assoc($rs_location);
$totalRows_rs_location = mysql_num_rows($rs_location);
$colname_rs_heading = "1";
if (isset($HTTP_GET_VARS['id'])) {
$colname_rs_heading = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] :
addslashes($HTTP_GET_VARS['id']);
}
mysql_select_db($database_conn_lcgeneral, $conn_*****);
$query_rs_heading = sprintf("SELECT * FROM heading WHERE id = %s ORDER BY
heading ASC", $colname_rs_heading);
$rs_heading = mysql_query($query_rs_heading, $conn_*****.) or
die(mysql_error());
$row_rs_heading = mysql_fetch_assoc($rs_heading);
$totalRows_rs_heading = mysql_num_rows($rs_heading);
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!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>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php echo $row_rs_course_search['title']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['heading']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['location']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['code']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['start_date']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['day']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['times']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['sessions']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['fee']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['reduced_fee']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['interview']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['award']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['provider']; ?></td>
</tr>
<tr>
<td><?php echo $row_rs_course_search['details']; ?></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_course_search);
mysql_free_result($rs_location);
mysql_free_result($rs_heading);
?>
What is the Request( ) function? ( e.g. Request("location") on line 11 ) I believe that is why you are getting the error. Should it not be $_REQUEST['location'] etc.?
Gotta admit that's another example of the shameful coding produced by DW MX.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks