PHP Redirects?

Hi Everyone,

I have a question regarding php redirects. If you visit the below URL and if your not logged in - your presented with a statement saying you have to be logged in (which is what I want) but after the person clicks on “Click Here” they are taken to the login page where they can login. My question is, how would I redirect visitors back to the car-search page they originally wanted to visit?

http://whatsmyowncarworth.com/class-work/sign2/car-search.php

This is my php session syntax on the car-search.php page.

<?php
session_start();

if (!isset($_SESSION['myusername'])) {
echo "Hello, you must have an account to view this page. <a href=\\"http://whatsmyowncarworth.com/class-work/sign2/main_login.php\\">Click Here</a>!<br>";
exit();
}
?>

Just save the current url in a session variable on each page.
After the login, redirect to that url.

HTH