title: Redirect to previous page and display error in a alert box
body: <p>In my project, the first PHP page takes input from user and submits it to the second PHP page. In the second PHP page, the values which come from first page are validated against values from database, using functions. I want to redirect to the first page if any of the values submitted  is wrong. Please help me out with the code. If not possible in PHP please mention the code in any other like jQuery or Ajax.</p>