How to add validation to a form
<p>I would like to validate a form so that it checks if the user is logged in...</p>

<p>I have got a form with method and action given below:</p>

<pre><code>&lt;form method=get action="index.php"&gt;
</code></pre>

<p>What I would like to do is that when I click on proceed to checkout, this form should validate if user is logged in. If not it will redirect to login page. I am hoping to put my php code inn the form so that user do not proceed to checkout unless he is logged in.</p>

<p>I tried to use onclick"if (($_SESSION['user_name']) == "")" then it should redirect to login.php.</p>
