I have three files; index.php, searchbar.php and search.php

now when i have search.php show its results on its own page its fine but when i try to include the search page in index.php i get nothing.

so i include the searchbox.php in index.php so i have a search bar, i then search for something and include the search.php page by using the $\_GET['p'] on the index.php but the search always come up blank, if i just leave search.php as its own page and dont try to include it then i get my results but id like for them to be included on the page they were searched from.

index.php

```
<?php

if (isset($_GET['p']) && $_GET['p'] != "") {

$p = $_GET['p'];

if (file_exists('include/'.$p.'.php')) {

@include ('include/'.$p.'.php');

} elseif (!file_exists('include/'.$p.'.php')) {

echo 'Page you are requesting doesn´t exist<br><br>';

}

} else {

@include ('news.php');

}

?>

```

searchbox.php

```
<div id="searchwrapper"><form action="?p=search" method="get">
<input type="text" class="searchbox" name="query" value=""  id="query"/>
<input type="image" src="search.png" class="searchbox_submit" value=""  ALT="Submit Form" id="submit"/>
</form>
</div>

```

search.php

```
<?php
include 'connect.php'; 
$searchTerms = $_GET['query'];
$query = mysql_query("SELECT * FROM misc WHERE itemname LIKE  '%$searchTerms%' ORDER BY itemname ");

{
echo "<table border='1' cellpadding='2' cellspacing='0' width=608 id='misc' class='tablesorter'><thead>";
echo "<tr> <th> </th> <th>Item Name</th> <th>Desc.</th></tr></thead><tbody>";
// keeps getting the next row until there are no more to get

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

    // Print out the contents of each row into a table
    echo "<tr><td width=50>";
    echo $row['image'];
    echo "</td><td width=150>";
    echo $row['itemname'];
    echo "</td><td width=250>";
    echo $row['desc'];
    echo "</td></tr>"; 
}

echo "</tbody></table>";;
}
if (mysql_num_rows($query) == 0)
{
  echo 'No Results';
}
?>

```
['https://Stackoverflow.com/questions/5213670', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/647328/']
I think that I would probably prefer an approach like

```
In[1]:= Physics[find_, have_:{}] := Solve[
  {d == vf*t - (a*t^2)/2 (* , etc *)} /. have, find]

In[2]:= Physics[d]
Out[2]= {{d -> 1/2 (-a t^2 + 2 t vf)}}

In[2]:= Physics[d, {t -> 9.7, vf -> -104.98, a -> -9.8}]
Out[2]= {{d -> -557.265}}

```

Where the `have` variables are given as a list of replacement rules.

As an aside, in these types of physics problems, a nice thing to do is define your physical constants like

```
N[g] = -9.8;

```

which produces a `NValues` for `g`. Then

```
N[tf] = 9.7;N[vf] = -104.98;
Physics[d, {t -> tf, vf -> vf, a -> g}]
%//N

```

produces

```
{{d->1/2 (-g tf^2+2 tf vf)}}
{{d->-557.265}}

```
Let me show some advanges of Simon's approach: 

![enter image description here](https://i.stack.imgur.com/pyBS7.png)