RE: Looking for help with forms/variables and an array!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey there my friend,
I left off what I thought was just rhetoric

Here is the whole 9 yrds in full with one or two minor changes as per my
reading.

I really appreciate this!

Thank you!

Brad


<?php require_once('connections/ftn.php'); ?>

<?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 1;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_ftn, $ftn);
$query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '$state'";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1,
$startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $ftn) or
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$colname_Recordset2 = "-1";
if (isset($_GET['range_key'])) {
  $colname_Recordset2 = (get_magic_quotes_gpc()) ? $_GET['range_key'] :
addslashes($_GET['range_key']);
}
mysql_select_db($database_ftn, $ftn);
$query_Recordset2 = sprintf("SELECT * FROM lstng_tbl WHERE range_key =
'%s'", $colname_Recordset2);
$Recordset2 = mysql_query($query_Recordset2, $ftn) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s",
$totalRows_Recordset1, $queryString_Recordset1);
?>

<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="index_dev2.php">
        <label>market
           <select name="states">
			   <OPTION value="IN">Indiana</OPTION>
			   <OPTION value="WI">Wisconsin</OPTION>
			   <OPTION value="IL">Illinois</OPTION>
			   <OPTION value="MI">Michigan</OPTION>
			   <OPTION value="GA">Georgia</OPTION>
			   <OPTION value="FL">Florida</OPTION>
			   </select>
			   <input name="submit" type="submit" value="post"/>
        </label>
   </form>
<?php 
  if ($states=="value" || !isset($states)) echo "selected"; 
?>
		<br>
<form id="form2" name="form2" method="post" action="index_dev2.php">
        <label>price_range
            <select name="price">
			   <OPTION value="1">Over $2 million</OPTION>
			   <OPTION value="2">$1 million - $2
million</OPTION>
			   <OPTION value="3">$750,000 - $1 million</OPTION>
			   <OPTION value="4">under $750,000</OPTION>
	        </select>
    	   <input name="submit" type="submit" value="post"/>
         </label>
 </form>
<?php 
  if ($price=="value"|| !isset($states)) echo "selected"; 
?>

  <?php do { ?>
  <tr>
    <td><?php echo $row_Recordset1['key']; ?></td>
    <td><?php echo $row_Recordset1['price_range']; ?></td>
    <td><?php echo $row_Recordset1['range_key']; ?></td>
    <td><?php echo $row_Recordset1['price']; ?></td>
    <td><?php echo $row_Recordset1['location']; ?></td>
    <td><?php echo $row_Recordset1['region']; ?></td>
    <td><?php echo $row_Recordset1['package']; ?></td>
    <td><?php echo $row_Recordset1['property_name']; ?></td>
    <td><?php echo $row_Recordset1['agent']; ?></td>
    <td><?php echo $row_Recordset1['company']; ?></td>
    <td><?php echo $row_Recordset1['phone_agent']; ?></td>
    <td><?php echo $row_Recordset1['agent_web']; ?></td>
    <td><?php echo $row_Recordset1['prty_descrb']; ?></td>
    <td><?php echo $row_Recordset1['email_agent']; ?></td>
    <td><?php echo $row_Recordset1['photo_1']; ?></td>
    <td><?php echo $row_Recordset1['Photo_2']; ?></td>
    <td><?php echo $row_Recordset1['Photo_3']; ?></td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p>
<table border="0" width="50%" align="center">
  <tr>
    <td width="23%" align="center"><?php if ($pageNum_Recordset1 > 0) { //
Show if not first page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0,
$queryString_Recordset1); ?>">First</a>
        <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center"><?php if ($pageNum_Recordset1 > 0) { //
Show if not first page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage,
max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
        <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_Recordset1 <
$totalPages_Recordset1) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage,
min($totalPages_Recordset1, $pageNum_Recordset1 + 1),
$queryString_Recordset1); ?>">Next</a>
        <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_Recordset1 <
$totalPages_Recordset1) { // Show if not last page ?>
        <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage,
$totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
        <?php } // Show if not last page ?>
    </td>
  </tr>
</table>
</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux