Jump to content

problem retrieving search results


Recommended Posts

I'm having difficulty with a search page. I followed the instructions in the Dreamweaver Help under "Building search/results pages (ColdFusion, ASP, JSP, PHP)", but it seems like the recordset is not recognizing the variables that are coming from the form. The variables [b]are[/b] being passed to the page; I put in a simple "echo($_REQUEST['varFamily']);" line and they show up.

Below is the code being used for the form (most options have been cut for the sake of brevity):
[code]
<form action="searchresults.php" method="post" name="searchform" id="searchform">
    <p>Fixture Family:<br />
      <select name="varFamily" id="varFamily">
        <option value="" selected="selected">choose family...</option>
        <option value="Avalon">Avalon</option>
        <option value="Carriage Hills">Carriage Hills</option>
        <option value="Centennial PW">Centennial PW</option>
      </select>
    </p>
    <p>Fixture Finish:<br />
      <select name="varFinish" id="varFinish">
        <option value="" selected="selected">choose finish...</option>
        <option value="Antique Silver Crackle">Antique Silver Crackle</option>
        <option value="Burnt Sienna">Burnt Sienna</option>
      </select>
    </p>
    <p>Fixture Type:<br />
      <select name="varType" id="varType">
        <option value="" selected="selected">choose type...</option>
        <option value="Accessories">Accessories</option>
        <option value="Bath Fixture">Bath Fixture</option>
      </select>
    </p>
    <p>Item Number:<br />
      <input name="itemnumber" type="text" id="itemnumber" />
    </p>
    <p>
    <input type="submit" name="Submit" value="Search" />
  </p>
</form>
[/code]

Here's a screenshot of the recordset window...
[url=http://img68.imageshack.us/img68/6353/recordsetbx3.gif]http://img68.imageshack.us/img68/6353/recordsetbx3.gif[/url]

...and following is the code it generates:
[code]
$varFinish_rs_getSearchResults = "%";
if (isset($HTTP_POST_VARS['varFinish'])) {
  $varFinish_rs_getSearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['varFinish'] : addslashes($HTTP_POST_VARS['varFinish']);
}
$varType_rs_getSearchResults = "%";
if (isset($HTTP_POST_VARS['varType'])) {
  $varType_rs_getSearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['varType'] : addslashes($HTTP_POST_VARS['varType']);
}
$varItemNumber_rs_getSearchResults = "%";
if (isset($HTTP_POST_VARS['varItemNumber'])) {
  $varItemNumber_rs_getSearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['varItemNumber'] : addslashes($HTTP_POST_VARS['varItemNumber']);
}
$varFamily_rs_getSearchResults = "%";
if (isset($HTTP_POST_VARS['varFamily'])) {
  $varFamily_rs_getSearchResults = (get_magic_quotes_gpc()) ? $HTTP_POST_VARS['varFamily'] : addslashes($HTTP_POST_VARS['varFamily']);
}
mysql_select_db($database_conn_catalog, $conn_catalog);
$query_rs_getSearchResults = sprintf("SELECT * FROM catalog WHERE family LIKE '%s' AND fixturefinish LIKE '%s' AND fixturetype LIKE '%s' AND itemnumber LIKE '%s'", $varFamily_rs_getSearchResults,$varFinish_rs_getSearchResults,$varType_rs_getSearchResults,$varItemNumber_rs_getSearchResults);
[/code]

Any ideas what I'm doing wrong? Thanks in advance!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.