Initialize the variable only once in php
<p>I am stuck in a problem where I need to initialize the session variable only once. When he hits submit and comes back to the same page, the variable value should be changed.</p>

<p>My <code>index.php</code> code is something like this:</p>

<pre><code>&lt;?php
session_start();
$_SESSION['session_variables_updated'] = 0;
?&gt;
&lt;form name="" method="post" action="index2.php"&gt;
    &lt;input type="submit" value="Submit" name="Submit"&gt;
&lt;/form&gt;

if ($_SESSION['session_variables_updated'] == 1) {
    //do something
}
</code></pre>

<p>My <code>index2.php</code> is:</p>

<pre><code>&lt;?php $_SESSION['session_variables_updated'] = 1; ?&gt;
&lt;a href="index.php"&gt;back&lt;/a&gt;
</code></pre>

<p>But since the variable is again being initialized, it is set to 0 every time. Any guidance on this problem?</p>