Jump to content

Beginner nees help with a complicated search parameters script


JTapp

Recommended Posts

I am an absolute beginner in a predicament.  I have a data results page (2results.php) that reports the data of three tables using a unique ID based on a $methode search drop down menu.

 

Unfortunately, I have now discovered I need to put a "search results" .php page in-between my 2search.html page and my 2results.php.

I am thinking this page will eliminate more than one return on my data as the script allows the user to choose which item they want to see further details on.

 

Here is a more definitive explanation:

 

Step One - user selects "search by zip code" on the drop down menu of my search.html page.  (you can do this on http://www.la-mason.com/search.html  -  use zip code: 71129)

 

Step Two - user gets redirected to a php table that reports the following fields (in some cases there will be more than one row because multiple companies may have the same zip code): company id, company name, City, and Zip and then it has a "view" button to view the rest of the details.  (this 'step two' is the part that doesn't exist that I desperately need help on)

 

Step Three - Once "view" is clicked they get the page you got when you search for the zip code, however, the new code will detail only one company's information - (not all companies in zip code 71129 as it currently returns) - only the company in zip code 71129 that you selected "view details" in step two.

 

I know this is a BIG task.... is anybody out there able to help me?  Code is below:

 

2search.html Code:

 

<form method="post" action="http://www.la-mason.com/2results.php" target="_blank">

<div align="center">

<table border="0" cellpadding="0" cellspacing="0">

<tr>

<td bordercolor="#000000">

<p align="center">

<select name="metode" size="1">

<option value="tblLodges.strLodgeName">Name</option>

<option value="tblLodges.intLodgeNumber">Number</option>

<option value="tblLodges.strDistrictName">District</option>

<option value="tblLodges.strLodgeLocationCity">City</option>

<option value="tblLodges.strLodgeLocationZIP">Zip</option>

<option value="tblLodges.strLodgeCounty">County</option>

</select> <input type="text" name="search" size="25">  <br>

Search database: <input type="submit" value="Go!!" name="Go"></p>

</td>

</tr>

</table>

</div>

</form>

 

 

2results.php code

//error message (not found message)begins

$XX = "No Record Found, to search again please close this window";

//query details table begins

$query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeWEB, tblLodges.strLodgeCounty, tblLodges.dtChartered, tblLodges.strLodgeMailingAddress, tblLodges.strLodgeMailingAddress2, tblLodges.strLodgeMailingCity, tblLodges.strLodgeMailingPostCode, tblLodges.strLodgeEmail, tblLodges.strLodgePhone, tblLodges.strLodgeFax, tblLodges.strDrivingDirectons, tblLodges.dtMeetingTime, tblLodges.dtMealTime, tblLodges.strFloorSchool, tblLodges.strLodgeNews, tblOfficers.strOfficerTitle, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE $metode LIKE '%$search%' GROUP BY tblLodges.strLodgeName LIMIT 0, 50");

while ($row = @mysql_fetch_array($query))

 

{

$variable1=$row["strLodgeName"];

$variable2=$row["intLodgeNumber"];

$variable3=$row["strDistrictName"];

$variable4=$row["strLodgeWEB"];

$variable5=$row["strLodgeCounty"];

$variable6=$row["dtChartered"];

$variable7=$row["strLodgeMailingAddress"];

$variable8=$row["strLodgeMailingAddress2"];

$variable9=$row["strLodgeMailingCity"];

$variable10=$row["strLodgeMailingStateCode"];

$variable11=$row["strLodgeMailingPostCode"];

$variable12=$row["strLodgeEmail"];

$variable13=$row["strLodgePhone"];

$variable14=$row["strLodgeFax"];

$variable15=$row["strDrivingDirectons"];

$variable16=$row["dtMeetingTime"];

$variable17=$row["dtMealTime"];

$variable18=$row["strFloorSchool"];

$variable19=$row["strLodgeNews"];

$variable20=$row["link"];

//table layout for results

 

echo ("<tr>");

echo "<center>\n";

echo "<p><b>GRAND LODGE OF LOUISIANA - LODGE LOCATOR RESULTS</b>\n</p>";

echo "<b>Lodge Name:</b> $variable1</p>";

echo "<p><b>Lodge Number:</b> $variable2</p>";

echo "<p><b>District Name:</b> $variable3</p>";

echo "<a href=\"$variable4\">Click Here To Go To The Lodge Website</a>";

echo "<p><b>Lodge County:</b> $variable5</p>";

echo "<p><b>Lodge Chartered On:</b> $variable6</p>";

echo "<p><b>Lodge Address:</b> $variable7, $variable8</p>";

echo '<p>' . $variable9 . $variable10 . $variable11 . '</p>';

echo "<a href=mailto:\"$variable12\">Click Here To Email The Lodge</a>";

echo "<p><b>Lodge Phone Number:</b> $variable13, <b>Lodge FAX Number:</b> $variable14</p>";

echo "<p><b>Lodge Driving Directions:</b> $variable15</p>";

echo "<p><b>Lodge Lodge Meeting Time:</b> $variable16</p>";

echo "<p><b>Lodge Lodge Meal Time:</b> $variable17</p>";

echo "<p><b>Lodge Floor School:</b> $variable18</p>";

echo "<p><b>Lodge News:</b> $variable19</p>";

echo "<img src='{$row['link']}'>";

echo "</center>\n";

echo ("</tr>");

}

?>                              </tr>

                            </table>

                            <hr width=75% align=center size=4>

<?php

//query details table begins

$query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeMailingCity, tblLodges.strLodgeMailingPostCode, tblLodges.strLodgeCounty, tblOfficers.strOfficerTitle, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE $metode LIKE '%$search%' LIMIT 0, 50");

 

$results=mysql_query($query);

echo "<center>\n";

echo "<H2>Roster of Lodge Officers</H2>\n";

echo "<table border='1'>

  <tr>

<th>Officer Title</th>

<th>Officer First</th>

<th>Officer Last</th>

<th>Officer Email</th>

<th>Officer Phone</th>

 

</tr>";

//

 

while ($row = mysql_fetch_array($query))

{

 

$variable1=$row["strOfficerTitle"];

$variable2=$row["strFirstName"];

$variable3=$row["strLastName"];

$variable4=$row["PersEmail"];

$variable5=$row["BusinessPhone"];

 

//table layout for results

 

print ("<tr>");

echo "<tr align=\"center\" bgcolor=\"#EFEFEF\">\n";

echo "<td class=\"td_id\">$variable1</td>\n";

echo "<td class=\"td_id\">$variable2</td>\n";

echo "<td class=\"td_id\">$variable3</td>\n";

echo "<td class=\"td_id\">$variable4</td>\n";

echo "<td class=\"td_id\">$variable5</td>\n";

print ("</tr>");

}

?>

</body>

</html>

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.