_____ From: BSumrall [mailto:Brads@xxxxxxxxx] Sent: Tuesday, June 12, 2007 6:43 PM To: 'Jim Lucas' Cc: 'php-general@xxxxxxxxxxxxx' Subject: RE: Looking for help with forms/variables and an array! 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