Note that there are some explanatory texts on larger screens.

plurals
  1. POPOST action SESSION variables Deletes
    text
    copied!<p>I have an index.php contains a javascript code to change my form action</p> <pre><code>&lt;script&gt; window.onload=function() { document.getElementsByName("myproject")[0].onchange=function() { var path = this.value; if (path) this.form.action=path+'/main.php'; } } &lt;/script&gt; </code></pre> <p>this script changes my form action everytime i change its value, then i have also a</p> <pre><code>&lt;form action = "" method = "POST"&gt;&lt;table&gt; &lt;td&gt;Select Project: &lt;/td&gt;&lt;td&gt;&lt;select name="myproject" id="myproject"&gt; &lt;td&gt;USERNAME: &lt;/td&gt;&lt;td&gt;&lt;input type="text" name="user" id="user"/&gt;&lt;/td&gt; &lt;td&gt;PASSWORD: &lt;/td&gt;&lt;td&gt;&lt;input type="password" name="pass" id="pass"/&gt;&lt;/td&gt; &lt;option value=""&gt;Please Select&lt;/option&gt; &lt;option value="Exam1"&gt;Exam1&lt;/option&gt; &lt;/select&gt;&lt;/td&gt; &lt;input type = "submit" name="login"/&gt; &lt;/form&gt; </code></pre> <p>and i also have a php code. this ive got</p> <pre><code>&lt;?php session_start(); error_reporting(0); $_SESSION['user'] = ""; $_SESSION['pass'] = ""; if ($_POST['login']) { $_SESSION['user'] = $_POST['user']; $_SESSION['pass'] = $_POST['pass']; ?&gt; </code></pre> <p>when i redirected to my Exam1/main.php , i lose the SESSION variables. my Exam1/main.php contains this code to determine if i got the session variables</p> <pre><code>&lt;?php session_start(); error_reporting(0); $mainuser = $_SESSION['user']; $mainpass = $_SESSION['pass'] ; echo $mainpass.$mainuser; ?&gt; </code></pre> <p>Why am i losing the session variables.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload