Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to take out <code>./</code> is in the <code>action=""</code> quotes like below (this is because you are using the same file to process the form)... and always start your php opening with <code>&lt;?php</code></p> <pre><code>&lt;form class="form1" method="post" action="" id="form1"&gt; &lt;fieldset&gt; &lt;ul&gt; &lt;p&gt;Please enter your username to continue to the webshop.&lt;/p&gt; &lt;label for="name"&gt;User Name:&lt;/label&gt;&lt;span&gt;&lt;input type="text" name="username" placeholder="User Name" class="required" role="input" aria-required="true"/&gt;&lt;/span&gt; &lt;input class="submit .transparentButton" value="Next" type="submit" name="Submit"/&gt; &lt;/ul&gt; &lt;br/&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php if (isset($_POST['Submit'])) { $_SESSION['username'] = $_POST['username']; } ?&gt; </code></pre> <p>And if you want to test it try something like this:</p> <pre><code>&lt;?php if (isset($_POST['Submit'])) { $_SESSION['username'] = $_POST['username']; // Use the following code to print out the variables. echo 'Session: '.$_SESSION['username']; echo '&lt;br&gt;'; echo 'POST: '.$_POST['username']; } ?&gt; </code></pre> <p>Tested the code after making the changes, and it works fine... look:</p> <blockquote> <p><img src="https://i.stack.imgur.com/tnLsZ.png" alt="Tested screenshot"></p> </blockquote> <hr> <p><strong>Update answer based of requests in the comments</strong></p> <pre><code>&lt;form class="form1" method="post" action="./" id="form1"&gt; &lt;fieldset&gt; &lt;ul&gt; &lt;p&gt;Please enter your username to continue to the webshop.&lt;/p&gt; &lt;label for="name"&gt;User Name:&lt;/label&gt;&lt;span&gt;&lt;input type="text" name="username" placeholder="User Name" class="required" role="input" aria-required="true"/&gt;&lt;/span&gt; &lt;input class="submit .transparentButton" value="Next" type="submit" name="Submit"/&gt; &lt;/ul&gt; &lt;br/&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>PUT THIS IN YOUR index.php</p> <pre><code>&lt;?php if (isset($_POST['Submit'])) { $_SESSION['username'] = $_POST['username']; // Use the following code to print out the variables. echo 'Session: '.$_SESSION['username']; echo '&lt;br&gt;'; echo 'POST: '.$_POST['username']; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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