how to generate summary page of a form before a user finally submit it to database

Keywords´╝Ü php

Question: 

I want my form to generate a preview page before it gets submitted to the database

my html code

    first name: <input type="text" name="fname"><br><br>
    last name: <input type="text" name="lname"><br><br>
    <input type="submit" name="submit" value="submit">

    from my php code
    $fname=$_POST['fname'];
    $lname=$_POST['lname'];

    mysql_connect("localhost", "mal", "pass123");
    mysql_select_db("testt");
    $select="insert into ttest (fname, lname) values (' ".$fname."', 
    '".$lname."')";
    $sql= mysql_query($select);
    mysql_close();

Answers: