RE: [PHP] Looking for help with forms/variables and an array!
| From: | BSumrall | Date: | Tue, 12 Jun 2007 22:43:07 +0000 |
| Subject: | RE: [PHP] Looking for help with forms/variables and an array! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256798@lists.php.net to get a copy of this message | ||
Oops, I spoke to soon.
It was switching records but the wrongs ones.
My bad
Here is what I am dealing with
The whole code!
<?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);
@extract($_POST);
$query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range='$region1'";
echo $query_Recordset1;
$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;
$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);
?>
</head>
<body>
<form id="form1" name="form1" method="post"
action="index_dev.php">
<label>market
<select name="select1">
<OPTION value="1">Indiana</OPTION>
<OPTION value="2">Wisconsin</OPTION>
<OPTION value="3">Illinois</OPTION>
<OPTION value="4">Michigan</OPTION>
<OPTION value="5">Georgia</OPTION>
<OPTION value="6">Florida</OPTION>
</select>
<input name="submit" type="submit"
value="post"/>
</label>
</form>
<tr>
<td>key</td>
<td>price_range</td>
<td>range_key</td>
<td>price</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['price_range']; ?></td>
<td><?php echo $row_Recordset1['range_key']; ?></td>
<td><?php echo $row_Recordset1['price']; ?></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Produces this
SELECT * FROM lstng_tbl WHERE price_range = ''
market Indiana Wisconsin Illinois Michigan Georgia Florida
key
price_range
range_key
price