There is a code:
<form name="step1" action="step2.php" method="POST">
Email: <input type="text" name="email" class="input-medium">
<button class="btn btn-small btn-warning" type="submit">Check</button>
</form>
And that: step2.php
<?php
$email = $_POST['email'];
$result = mysql_query("SELECT email,discount FROM buyers WHERE email='$email'");
if (mysql_num_rows($result) <= 0)
{
echo "Are you a new client is't it? <br>";
echo "Your discount is 0%<br>";
}
else{
echo "<br/>Nice to see you again! <br/>";
$getSalary = mysql_fetch_array($result);
echo "You discount is already: ";
echo $getSalary[discount];
echo " %";
}
?>
So, is it possible to get request in database without submit the form and redirect to new page (step2.php in this example)? I mean, query result is shown immediately.. I think about onBlur() method, but I don't know how create similar request with JavaScript. Maybe it is possible with AJAX?
I would be grateful for any advice. Thx a lot.