Autocomplete UI doesn't work with PHP file

Autocomplete UI doesn't work with PHP file

Hello everybody,
It will be great if you give me an idea why this simple autocomplete code doesn't work.

Here is the html portion;

---------------------------------------------------------------------------
<html>
    <head>
       
        <link rel="stylesheet" type="text/css" href="development-bundle/themes/redmond/jquery-ui-1.8.5.custom.css">
       
        <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js" type="text/javascript">
        <script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>
        <script type="text/javascript">
        $(function()
        {
       
            $("#state").autocomplete({
                source: "states.php",
                minLength: 2,
                select: function(event, ui)
                {
                    $('#state_id').val(ui.item.id);
                   
                }
            });
           
        });
        </script>
    </head>
<body>

      <form action="<?php echo $PHP_SELF;?>"  method="post">
            <input type="text" id="state"  name="state" />
            <input type="submit" name="submit" value="Submit" /></p>

      </form>

</body>
</html>
---------------------------------------------------------------------------

This is the php protion

---------------------------------------------------------------------------

<?php
    $return_arr = array();
   
    include_once('includes/connect.php');

    // If connection to database, run sql statement. */
    $fetch = mysql_query("SELECT * FROM tags WHERE tag like '%" . $_GET['term'] . "%'");
   
    // Retrieve and store in array the results of the query.*/
   
    while ($row = mysql_fetch_array($fetch))
    {
        $row_array['tag'] = $row['tag'];
           
        array_push($return_arr, $row_array);
    }

    // Toss back results as json encoded array. */
    echo json_encode($return_arr);
   
?>