How to make a poll on one page?

Hello everyone! I’m pretty much a complete noob when it comes to php, but I’m really hoping to learn.

Anyways, I’m attempting to make a poll on my website. I want to make it so you can select a single choice, click vote, and then view the results.
I want this to all be on the same page, but currently I have no idea how to do that.

I’m currently trying to do all this here: Zelda poll

//open database connection
$connection = mysql_connect($host, $user, $pass) or die('ERROR: Unable to connect!');

//select database
mysql_select_db($db) or die('ERROR: Unable to select database!');

//generate and execute query
$query = "SELECT qid, qtitle FROM questions ORDER BY qdate DESC LIMIT 0,1";
$result = mysql_query($query) or die("ERROR: $query.".mysql_error());

//if records are present
if (mysql_num_rows($result) > 0)
{
    $row = mysql_fetch_object($result);
    //get question id and title
    $qid = $row->qid;
    
    echo '<h2>'.$row->qtitle.'</h2>';
    //echo "<form method = post action = 'phpPoll/user_submit.php'>";
    echo  "<form action='phpPoll/user_submit.php' method='post'>";
    
    //get possible answers using question ID
    $query = "SELECT aid, atitle FROM answers WHERE qid = '$qid' ORDER BY aid ASC";
    $result = mysql_query($query) or die("ERROR: $query.".mysql_error());
    
    if (mysql_num_rows($result) > 0)
    {
       //print answer list as radio buttons
        while ($row = mysql_fetch_object($result))
        {
            echo "<input type = radio name = aid value = '".$row->aid."'>'".$row->atitle."'</input><br />";
        }
        echo "<input type = hidden name = qid value = '".$qid."'>";
        echo "<input type = submit name = submit value = 'Vote!'>";
    }
    echo '</form>';
}
//if no records present, display message
else
{
    echo '<font size="-1">No questions currently configured</font>';
}
//close connection
mysql_close($connection);

?>

Basically when ever I hit the ‘Vote’ button I get sent over to user_submit.php, but I want to process that and then show off view.php?qid=2

Any advice or pointing towards relevant tutorials would be vastly appreciated!

Post the code currently inside phpPoll/user_submit.php.