Jump to content

Search Menu Problem


nicklascortez

Recommended Posts

Good morning,

 

Its about this website

www.deltaboatcenter.nl

 

Boats page!

 

I wanna search tough the boats we are selling with a seach menu, the menu is there (see website)

but is got 2 scrips (below)

the first one i use now the boats preview nicely on the website and work good but cant search with the boat menu for boat brands.

 

the second one does search trough boat brands but doenst come up with boats at all..

 

 

<?php
include('dbclass/db.php');
include('define.php');
//////////include('pagination.class.php');
include('include/ps_pagination.php');
include_once('classes/easyphpthumbnail.class.php');


$thumb = new easyphpthumbnail;
$thumb -> Thumbheight = 140;
$thumb -> Thumbwidth = 200;
$thumb -> Thumblocation = 'thumb/';
$thumb -> Thumbprefix = 'thumb_';
$thumb -> Thumbsaveas = 'png';

if($lang == 'eng')
{
$header = "header_eng.php";
$footer = "footer_eng.php";
$where = 'language_id=1';
$language =1;
}
elseif($lang == 'dutch')
{
$header = "header_dutch.php";
$footer = "footer_dutch.php";
$where = 'language_id=2';
$language =2;
}
elseif($lang == 'german')
{
$header = "header_german.php";
$footer = "footer_german.php";
$where = 'language_id=3';
$language =3;
}
else
{
$header = "header_eng.php";
$footer = "footer_eng.php";
$where = 'language_id=1';
$language =1;
}

//select query
                       $obj = new Database;
                        $obj ->select('english_boats','',$where);
                        
                        
                         $query= "select * from english_boats where language_id=$language";
                            $pager = new PS_Pagination($obj->getConnection(),$query,5,3);
                           $rs = $pager->paginate();

                        /////////var_dump($rs);
                        ///////exit;
                       $sel= "select * from english_boats";
                      /// $q=mysql_query($sel) or die mysql_error();

                       //generate thumbnail
                     //  include('boat_function.php');


?>
<!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>
<script type='text/javascript' src='jspop/jquery.js'></script>
<script type='text/javascript' src='jspop/jquery.simplemodal.js'></script>
<script type='text/javascript' src='jspop/osx.js'></script>
<script src="prototype.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Delta Boat company boat listing</title>
<link href="boatstyle/boatstyle.css" rel="stylesheet" type="text/css" />
</head>

<body class="background">
<script>
function dosubmit( ) {
  new Ajax.Updater( 'result', 'search_boat.php', { method: 'post',
    parameters: $('myform').serialize() } );
  $('myform').reset();
}

//get_call
function get_call( ) {
if(document.calform.name.value=="")
            {
            //inlineMsg('name','please enter the name',20);
             alert('Please enter the name');
             document.calform.name.focus();
             return false;
             }
             var phone = /-\d{7}/ ;

             if(!phone.test(document.calform.tel_number.value))
             {
             alert('Please enter the telephone number');
             document.calform.tel_number.focus();
             return false;
             }
var aemail= /^[a-z0-9_\+-]+(\.[a-z0-9_\+-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,4})$/;

             if(!aemail.test(document.calform.email.value))
             {
             alert('Please enter the valid email address');
             document.calform.email.focus();
             return false;
             }
  new Ajax.Updater( 'get_result', 'make_home_appointment.php', { method: 'post',
    parameters: $('calform').serialize() } );
  $('calform').reset();
}
</script>
<div class="container">
  <?php include($header);
  ?>
  <div class="clear"></div>
  <div class="line"></div>
  <div class="searchPanel">

    <div class="searchTop"></div>
    <div class="clear"></div>
    <div class="searchMid">
      <div class="searchTitle">Search</div>
    <div class="searchForm">
    <!--javascript:get(document.getElementById('myform'));-->
    <form id="myform">
    <input type="hidden" name="language" value="<?php echo $language;?>" />

    <table class ="textboxAlign" width="100%" border="0">
      <tr>
        <td width="38%" class="searchItem">Brand:</td>
        <td width="62%" class="searchItem"><div class="textboxAlign">
          <select name="brand" id="brand" style="width:140px">
              <option value="any">any</option>
              <?php while($r_b =mysql_fetch_array($q)){ ?>
       <option value="<?php echo $r_b['boat_brand'];?>"><?php echo $r_b['boat_brand'];?></option>
              <?php }?>
              <!--    <option value="brand B">Company B</option>
            <option value="brand C">Company C</option>
            <option value="brand D">Company D</option>-->
                  </select>
        </div></td>
      </tr>
      <tr>
        <td nowrap="nowrap" class="searchItem">Year From:</td>
        <td class="searchItem"><div class="textboxAlign">
  <input type="text" name="year_from" id="year_from" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
  To:
  <input type="text" name="year_to" id="year_to" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
        </div> </td>
      </tr>
      <tr>
        <td class="searchItem">Price From:</td>
        <td class="searchItem"><div class="textboxAlign">
  <input type="text" name="price_from" id="price_from" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
  To:
  <input type="text" name="price_to" id="price_to" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"/>
        </div></td></tr>
      <tr>
        <td class="searchItem" valign="top">Features:</td>
        <td nowrap="nowrap" class="searchItem"><input type="checkbox" name="heating" id="heating"  value="588" />           Heating System</td>
      </tr>
      <tr>
        <td> </td>
        <td class="searchItem">
          <input type="checkbox" name="generator" id="generator"  value="661" />
           Generator</td>
      </tr>
       <tr>
        <td> </td>
        <td class="searchItem" align="left">
          <input type="checkbox" name="bow" id="bow_thruster"  value="297" />
           Bow Thruster</td>
      </tr>
       <tr>
        <td> </td>
        <td class="searchItem">
          <input type="checkbox" name="stern" id="stern_thruster"  value="964" />
           Stern Thruster</td>
      </tr>
      <tr>
      <td colspan="2" align="center">
      <input type="button" onclick="dosubmit()" value="Search">
     <!-- <input type="button" name="button" class="button" value="Search" onclick="javascript:get(this.parentNode);" />-->      </td>
      </tr>
    </table>
    </form>
    </div>
  </div>
    <div class="searchBase"></div>
    <div class="clear"></div>
  </div>
  <div id="result">

  <div class="thumbnailsDisplayArea">

   <?php if(!isset($_GET['page']) || ($_GET['page']==1)) { $i=1; }
              else { $i=(($_GET['page']-1)*10)+1 ; }

            if(mysql_num_rows($rs)>0)
                            {
                                   while($row_fetch=mysql_fetch_assoc($rs))
                                {?>
                                  <?PHP $i++; ?>


      <div class="listPanel">
        <div class="listTop"></div>
        <div class="listMid">
          <a href="boat_detail.php?id=<?php echo $row_fetch ['boat_id'];?> & common_id=<?php echo $row_fetch['common_id']; ?>"><div class="itemName" align="left"><?php echo $row_fetch['boat_title'];?> </div></a>
         <div class="itemPrice"><?php echo $row_fetch['price_currency'];?> <?php echo $row_fetch['boat_price'];?></div>
         <div class="clear"></div>
        <div class="itemDescription" align="left">
            <a href="boat_detail.php?id=<?php echo $row_fetch['boat_id'];?>&common_id=<?php echo $row_fetch['common_id']; ?>"><?php echo $row_fetch['boat_summary'];?></a>
             <div class="moreLink"><!--<a href="boat_detail.php?id=<?php //echo $value['boat_id'];?> & common_id=<?php //echo $com_id?>">more...</a>--></div>
             <div class="clear"></div>
        </div>

         <div class="ItemThumbnail">
         <a href="boat_detail.php?id=<?php echo $row_fetch ['boat_id'];?>&common_id=<?php echo $row_fetch['common_id'];?>">

          <?php
          ///////exit;
            $where=sprintf("common_id=%d",$row_fetch['common_id']);
              $obj ->select('boat_images','',$where);
            $array = $obj ->get('');
            if(count($array)>0){

            $imagename=$array[0]["boat_image"];

          $thumb_name="thumb/thumb_$imagename";
          $thumb_name=str_replace("jpg","png",$thumb_name);


           if(!file_exists($thumb_name))
          {

               $thumb -> Createthumb("admin/uploads/$imagename","file");
          }
        ?><?php
        }
        ?>
        <img src="<?php echo $thumb_name; ?>" border=0 />
        </a><br />
   </div>
        </div>

        <div class="listBase"></div>
      </div>

      <div class="clear"></div>


<?php }}else {
     echo 'NO image found';}?>
<div class="paging2">
      <?php
              if(mysql_num_rows($rs)>0){
       echo $pager->renderFullNav(); }?>
        <div class="clear"></div>
      </div></div>

    <div class="verticalSpacer"></div>


  <div class="clear"></div>
  <div class="line"></div>
  <div class="footer">
  <?php  include($footer);?></div>
   <?php include('language.php');?>
<div class="clear"></div>
</div>
</div>



</body>
</html> 

<?php
include('dbclass/db.php');
include('define.php');

if($lang == 'eng')
{
$header = "header_eng.php";
$footer = "footer_eng.php";
$where = 'language_id=1';
$language =1;
}
elseif($lang == 'dutch')
{
$header = "header_dutch.php";
$footer = "footer_dutch.php";
$where = 'language_id=2';
$language =2;
}
elseif($lang == 'german')
{
$header = "header_german.php";
$footer = "footer_german.php";
$where = 'language_id=3';
$language =3;
}
else
{
$header = "header_eng.php";
$footer = "footer_eng.php";
$where = 'language_id=1';
$language =1;
}

//select query
                       $obj = new Database;

                        $obj ->select('english_boats','',$where);
                        $array = $obj ->get('');

                        //get brands
                        $s = "select distinct boat_brand from english_boats";
                        $q = mysql_query($s) or die(mysql_error());
                        //generate thumbnail


?>
<!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>

<script type="text/javascript" language="javascript">

   var http_request = false;
   function makeRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
             // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      http_request.onreadystatechange = alertContents;
      http_request.open('GET', url + parameters, true);
      http_request.send(null);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;


              document.getElementById('myspan').innerHTML = result;

         } else {
            alert('There was a problem with the request.');
         }
      }
   }

   function get(obj) {


      var getstr = "?";
      for (i=0; i<obj.childNodes.length; i++) {
         if (obj.childNodes[i].tagName == "INPUT") {
            if (obj.childNodes[i].type == "text") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "hidden") {
               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
            }
            if (obj.childNodes[i].type == "checkbox") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               } else {
                  getstr += obj.childNodes[i].name + "=&";
               }
            }
            if (obj.childNodes[i].type == "radio") {
               if (obj.childNodes[i].checked) {
                  getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
               }
            }
         }
         if (obj.childNodes[i].tagName == "SELECT") {
            var sel = obj.childNodes[i];
            getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";
         }

      }
        document.getElementById('myspan').innerHTML = '<img src="images/wait30trans.gif" alt="loading" />' + 'Loading';
        //setTimeout('alert(\'Surprise!\')', 5000);

     makeRequest('search_boat.php', getstr);
   }
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Delta Boat company about us</title>
<link href="boatstyle/boatstyle.css" rel="stylesheet" type="text/css" />
</head>

<body class="background">
<div class="container">
  <?php include($header);
  ?>
  <div class="clear"></div>
  <div class="line"></div>
  <div class="searchPanel">

    <div class="searchTop"></div>
    <div class="clear"></div>
    <div class="searchMid">
      <div class="searchTitle">Search</div>
    <div class="searchForm">
    <!--javascript:get(document.getElementById('myform'));-->
    <form action="javascript:get(document.getElementById('myform'));" name="myform" id="myform">
    <!--<form action="" name="form">-->
    <table class ="textboxAlign" width="100%" border="0">
      <tr>
        <td width="38%" class="searchItem">Brand:</td>
        <td width="62%" class="searchItem"><div class="textboxAlign">
          <select name="brand" id="brand" style="width:140px">
              <option value="any">any</option>
              <?php while($r_b =mysql_fetch_array($q)){ ?>
              <option value="<?php echo $r_b['boat_brand'];?>"><?php echo $r_b['boat_brand'];?></option>
              <?php }?>
              <!--    <option value="brand B">Company B</option>
            <option value="brand C">Company C</option>
            <option value="brand D">Company D</option>-->
                  </select>
        </div></td>
      </tr>
      <tr>
        <td nowrap="nowrap" class="searchItem">Year From:</td>
        <td class="searchItem"><div class="textboxAlign">
  <input type="text" name="year_from" id="year_from" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"
  />
  To:
  <input type="text" name="year_to" id="year_to" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"
/>
        </div> </td>
      </tr>
      <tr>
        <td class="searchItem">Price From:</td>
        <td class="searchItem"><div class="textboxAlign">
  <input type="text" name="price_from" id="price_from" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"
/>
  To:
  <input type="text" name="price_to" id="price_to" value="any" size="5" onfocus="if(this.value == this.defaultValue) this.value = ''"
/>
        </div></td></tr>
      <tr>
        <td class="searchItem" valign="top">Features:</td>
        <td nowrap="nowrap" class="searchItem"><input type="checkbox" name="heating" id="heating"  value="588" />           Heating Sysytem</td>
      </tr>
      <tr>
        <td> </td>
        <td class="searchItem">
          <input type="checkbox" name="generator" id="generator"  value="661" />
           Generator</td>
      </tr>
       <tr>
        <td> </td>
        <td class="searchItem" align="left">
          <input type="checkbox" name="bow" id="bow_thruster"  value="297" />
           Bow Thruster</td>
      </tr>
       <tr>
        <td> </td>
        <td class="searchItem">
          <input type="checkbox" name="stern" id="stern_thruster"  value="964" />
           Stern Thruster</td>
      </tr>
      <tr>
      <td colspan="2" align="center">
      <input type="button" name="button" class="button" value="Submit" onclick="javascript:get(this.parentNode);" />      </td>
      </tr>
    </table>
    </form>
    </div>
  </div>
    <div class="searchBase"></div>
    <div class="clear"></div>
  </div>
  <div id="myspan">

  <div class="thumbnailsDisplayArea">

  <?php
  if(count($array))
  {
  while(list($k,$value) = each($array))
     {
     $com_id = $value['common_id'];
     $im_where = 'common_id='.$com_id;
     $obj ->select('boat_images','',$im_where);
     $im_array = $obj ->get('');
    $filename = $im_array[0]['boat_image'];




     ?>

      <div class="listPanel">
        <div class="listTop"></div>
        <div class="listMid">
          <a href="boat_detail.php?id=<?php echo $value['boat_id'];?> & common_id=<?php echo $com_id?>"><div class="itemName" align="left"><?php echo $value['boat_title'];?> </div></a>
         <div class="itemPrice"><?php echo $value['price_currency'];?> <?php echo $value['boat_price'];?></div>
         <div class="clear"></div>
        <div class="itemDescription" align="left">
            <a href="boat_detail.php?id=<?php echo $value['boat_id'];?>&common_id=<?php echo $com_id?>"><?php echo $value['boat_summary'];?></a>
             <div class="moreLink"><!--<a href="boat_detail.php?id=<?php //echo $value['boat_id'];?> & common_id=<?php //echo $com_id?>">more...</a>--></div>
             <div class="clear"></div>
        </div>

         <div class="ItemThumbnail"><a href="boat_detail.php?id=<?php echo $value['boat_id'];?>&common_id=<?php echo $com_id?>"><?php //createThumbnail($filename);?><img src="admin/uploads/<?php echo $im_array[0]['boat_image'];?>" width="200px" height="140px" border="0" /></a></div>
        </div>
        <div class="listBase"></div>
      </div>

      <?php }}?>
      <div class="clear"></div>
    </div>
    </div>
      <div class="verticalSpacer"></div>
  <div class="clear"></div>
  <div class="line"></div>
  <div class="footer">
  <?php  include($footer);?></div>
   <?php include('language.php');?>
<div class="clear"></div>
</div>

</body>
</html> 

The strange thing is both scripts work but not good. the first one wont seach trou the boat list. and the second one does but doesent show the boats in the first place..

 

Does some one has any idea what i'm doing wrong?

 

Kind regarts

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.