hi all,
I have built search form that it retrieves information from database.
for ex: when i click axtar (search) button it retrieves normally but when i click ENTER button via keyboard instead of axtar (search) button but it only displays results with white blank page

here is web page address.
http://rabotnik.karyeram.com
Thanks in advance for attention

Aze,

From what I can see, Enter doesn't have the required action because the ajax handler is attached to the submit button ("search_button"). Enter will not trigger this button's event unless the button has focus.

However, Enter will trigger the form's submit event when various form elements have focus, importantly text input fields. I don't know if this is W3C recommendation but most browsers seem to behave this way.

Therefore, try attaching the ajax handler to the form's submit event, eg.

$("document.forms[0]").submit(function(){
    ....
    return false;
});

This will give you a fighting chance.

Airshow

thank you very much. İ did it by disabling enter ket in İE.
but i have one question again how can i search with the help of select?
my web apge is.http://rabotnik.karyeram.com
my php file is. do_search.php
this searches with the help of AJAX and jQuery but only according to the words typed into input box. but i would like to search with the Thanks again for attention

<?php
//if we got something through $_POST
if (isset($_POST['search'])) {
    // here you would normally include some database connection
    include("config/connect.php");
     $db=new funksiyalar('karyeram');
 //   $db = new db();
    // never trust what user wrote! We must ALWAYS sanitize user input
    $word = mysql_real_escape_string($_POST['search']);
    $cat=mysql_real_escape_string($_POST['mezmun']);
    // build your search query to the database
   
    $sql = "SELECT id, seher, mezmun, place, subyekt, date, sekil from jobs WHERE subyekt LIKE '%" . $word . "%' ORDER BY id LIMIT 10";
   
   
    $row = $db->query($sql);
    if(count($row)) {
        $end_result = '';
        echo '<table width="840px">
    <tr id="basliq"><td id="basliq1">Şəhər</td><td id="basliq2">Vəzifənin adi</td><td id="basliq3">Sahə</td><td id="basliq4">İş yeri</td><td id="basliq5">Tarix</td></tr>';
        foreach($row as $r) {
            $result=$r['mezmun'];
            $result2=$r['seher'];
              $result1=$r['subyekt'];
            $result3=$r['place'];
            $result4=$r['id'];
            // we will use this to bold the search word in result
            $bold           = '<span class="found">' . $word . '</span>';
    $end_result     .= "<tr><td id=\"xana0\">" . str_ireplace($word, $bold, $result2) . "</td><td id=\"xana1\"><a href=\"index.php?id=$result4\">" . str_ireplace($word, $bold, $result1) . "</a></td><td id=\"xana1\">" . str_ireplace($word, $bold, $result) . "</td><td id=\"xana1\">" . str_ireplace($word, $bold, $result3) . "</td><td id=\"xana1\"/td></tr>";
        }
        echo $end_result;
        echo '</table>';
        
    } else {
        echo '<li>No results found</li>';
    }
}
?>

Is the select menu supposed to contribute to the search term?

If so, what is supposed to happen if the user types something AND selects an option from the menu?

Do they compete or add, or does one have priority over the other?

How are your users going to know the rules when the interface is not self-explanatory?

Airshow

Is the select menu supposed to contribute to the search term?

If so, what is supposed to happen if the user types something AND selects an option from the menu?

Do they compete or add, or does one have priority over the other?

How are your users going to know the rules when the interface is not self-explanatory?

Airshow

You know i would like let users could choose according to both categories and search term.
for ex: User choose city (Baku) and types into input box accountant. when user chose it displays accountant jobs in Baku city
Thank you very much for attention!

In that case, insert the word "and" (or its local language translation) between the two form elements so your users know how the two values will be interpreted.

Everything else is server-side and should be addressed in the php forum.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.