Forums

PHP

This topic is locked

Search Form Not Showing Results

Posted 04 Mar 2007 06:06:32
1
has voted
04 Mar 2007 06:06:32 Peggy S posted:
I've solved my problem. I had my search page defined with a PHP extension. Changed it to an HTML and bam - there was my data. I would have deleted my post be don't see the icon to delete it.

I'm just learning both Dreamweaver and PHP and can't seem to get past this problem. Only my typed text is being returned on myresults.php page. I know it's something stupid and simple - that is for someone with more of a clue than me!!! Thanks for your help.

I'm using Dreamweaver 8, mysql database and apache for my server.

I have a simple search form. The code for mysearch.php:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="myform" name="myform" method="post" action="myresults.php">
<p>
<label>
<input type="radio" name="Length" value="Long" />
Long</label>
<br />
<label>
<input type="radio" name="Length" value="Short" />
Short</label>
<br />
<label>
<input type="radio" name="Length" value="Either" />
Either</label>
<br />
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
</p>
</form>
</body>
</html>

When I hit search the page is returned without any results even though they show up when I test my recoreset.

Here is the code for myresults.php page:

<?php require_once('Connections/connpsdatabase.php'); ?>
<?php
$colname_rsSearch = "-1";
if (isset($_POST['length'])) {
$colname_rsSearch = (get_magic_quotes_gpc()) ? $_POST['length'] : addslashes($_POST['length']);
}
mysql_select_db($database_connpsdatabase, $connpsdatabase);
$query_rsSearch = sprintf("SELECT manName, manModel FROM testtable WHERE manLSE = '%s'", $colname_rsSearch);
$rsSearch = mysql_query($query_rsSearch, $connpsdatabase) or die(mysql_error());
$row_rsSearch = mysql_fetch_assoc($rsSearch);
$totalRows_rsSearch = mysql_num_rows($rsSearch);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<p>M Name<?php echo $row_rsSearch['manName']; ?></p>
<p>Model <?php echo $row_rsSearch['manModel']; ?></p>
</body>
</html>
<?php
mysql_free_result($rsSearch);
?>





Edited by - pestar on 05 Mar 2007 20:50:17

Reply to this topic