title: Search function works on localhost but not on server
body: <p>I am trying to add a search function to my website.  Right now it's very rudimentary, and the search is simply pulling results from MySQL using select.  The problem is, the search works great when I test it on localhost but doesn't work at all when I put it on the server.  When it is used it simply selects the entire database.  I believe the problem is that the variable isn't getting passed to the search results page, but I don't know.</p>
  
  <p>Here's the code for the search box.  It is in a referenced file called "header.php":</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
  &lt;body&gt;
  &lt;div class="title"&gt;&lt;img style="width:100%;" src="title.gif" /&gt;&lt;/div&gt;
  &lt;div class="search"&gt;Search: 
  &lt;form style="display:inline" name="search" action="search.php" method="get"&gt;&lt;?php echo"         &lt;input type='text' name='query' /&gt;";?&gt;
  &lt;a href="javascript: searchSubmit()"&gt;&lt;img src="seo.png" alt="Search" title="Search" /&gt;   &lt;/a&gt;&lt;/form&gt;&lt;/div&gt;
  &lt;ul class="menu"&gt;
  &lt;li&gt;&lt;a href="index.php#home"&gt;home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="submit.php?title=&amp;desc="&gt;post an idea&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#about"&gt;about us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#contact"&gt;contact us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="login.php"&gt;log in&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And here's the code from search.php:</p>
  
  <pre><code>&lt;?php
  $search=$_GET['query'];
  $search=mysql_real_escape_string($search);
  ?&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;?php
  echo "&lt;title&gt;Search: $search&lt;/title&gt;";
  ?&gt;
  &lt;link rel="stylesheet" type="text/css" href="mainstyle.css" /&gt;
  &lt;script type="text/javascript" src="validate.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="title"&gt;&lt;img style="width:100%;" src="title.gif" /&gt;&lt;/div&gt;
  &lt;div class="search"&gt;Search: 
  &lt;form style="display:inline" name="search" action="search.php" method="get"&gt;&lt;?php echo"    &lt;input type='text' name='query' value='$search'/&gt;";?&gt;
  &lt;a href="javascript: searchSubmit()"&gt;&lt;img src="seo.png" alt="Search" title="Search" /&gt;&lt;/a&gt;&lt;/form&gt;&lt;/div&gt;
  &lt;ul class="menu"&gt;
  &lt;li&gt;&lt;a href="index.php#home"&gt;home&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="submit.php?title=&amp;desc="&gt;post an idea&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#about"&gt;about us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#contact"&gt;contact us&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="login.php"&gt;log in&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;?php
  
  mysql_connect("localhost","root","root") or die(mysql_error());
  mysql_select_db("date_ideas") or die(mysql_error());
  
  $result=mysql_query("SELECT * FROM ideas WHERE title LIKE '%".$search."%' ORDER BY    post_date DESC");
  echo "SELECT * FROM ideas WHERE title LIKE '%".$search."%' ORDER BY post_date DESC";
  
  echo "&lt;span id='none'&gt;";
  while($row = mysql_fetch_array($result))
  {
  $id=$row['id'];
  echo "&lt;h2 class='center'&gt;&lt;a href='ideaview.php?id=$id' title='View ".$row['title']."     Description'&gt;" . $row['title'] . "&lt;/a&gt;&lt;br/&gt;";
  echo "&lt;span class='date'&gt;";
  $date=$row['post_date'];
  $time=time();
  
  if (($time-$date)&lt;120)
  {
  echo "Posted 1 minute ago";
  }
  
  else if (($time-$date)&gt;120&amp;&amp;($time-$date)&lt;3600)
  {
  $minutes=($time-$date)/60;
  echo ("Posted " . round($minutes) . " minutes ago");
  }
  else if (($time-$date)&gt;3600&amp;&amp;($time-$date)&lt;7200)
  {
  echo "Posted 1 hour ago";
  }
  else if (($time-$date)&lt;86400&amp;&amp;($time-$date)&gt;7200)
  {
  $hours=($time-$date)/3600;
  echo ("Posted " . round($hours) . " hours ago");
  }
  else if (($time-$date)&lt;172800&amp;&amp;($time-$date)&gt;86400)
  {
  echo "Posted 1 day ago";
  }
  else
  {
  echo ("Posted on " . date("m-d-y",$date));
  }
  echo "&lt;/span&gt;&lt;/h2&gt;";
  }
  echo "&lt;/span&gt;";
  ?&gt;
  
  &lt;script type="text/javascript"&gt;
  document.getElementById("none");
  if (none.innerHTML == "")
  {
  none.innerHTML="&lt;p class='center'&gt;There are no ideas matching your search&lt;/p&gt;";
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Lastly, here's the code for the javascript used to submit the form:</p>
  
  <pre><code>var valid=true;
  
  function validate(field, helptext, type, min, max, field1)
  {
  var x=field.value;
  var text=document.getElementById(helptext);
  if (x==null || x=="")
  {
  if (text!=null)
      {
      text.innerHTML="Please input "+field.id;
      }
  valid=false;
  }
  else if (type=="length")
  {
  valLength(min,max,field,helptext);
  }
  else if (type=="email")
  {
  valEmail(field,helptext);
  }
  else if (type=="pass")
  {
  valPass(field, field1, helptext);
  }
  else
  {
  if (text!=null)
      {
      text.innerHTML="";
      }
  valid=true;
  }
  }
  
  function searchSubmit()
  {
  validate(search.query);
  if (valid==true)
  {
  search.submit();
  }
  else
  {
  alert("Please enter a search term");
  }
  }
  </code></pre>
  
  <p>As I said, when I use it on my localhost on my computer, it works perfectly, returning only the rows where title matches the search.  When I put it on the server, however, it returns all the rows in the table.</p>