//i have made a function. but i can't call the function generateOrderedArray() as it says there is a Fatal error. help me! this //is my coding
<form action="" method="post" enctype="multipart/form-data">
<html>
<table>
<tr>
<td>
<input name="location" type="radio" value="Jasin">Jasin
<input name="location" type="radio" value="Merlimau">Merlimau</div></td>
</tr>
<tr>
<td> <input type="submit" name="submit" value="Search" class="butoonfunction" />
</td>
</tr>
</table>
</form>
</html>
<?php
include("config.php");
if (isset($_POST['submit']))
{
$search = $_POST['location'];
$binaryArray = generateOrderedArray();
print (binarySearch($binaryArray, $search));
function binarySearch($array, $searchFor)
{
$low = 0;
$high = count($array) - 1;
$mid = 0;
while ($low <= $high)
{
$mid = floor(($low + $high) / 2);
$element = $array[$mid];
if ($searchFor == $element)
{
return $mid;
}
else if ($searchFor < $element)
{
$high = $mid - 1;
}
else
{
$low = $mid + 1;
}
}
return -1;
}
function generateOrderedArray()
{
$arr = mysql_query("Select location from houserent");
$array = array($arr);
print_r($array);
return $array;
}
}
?>