Note that there are some explanatory texts on larger screens.

plurals
  1. POvariable not recognized php
    primarykey
    data
    text
    <p>I have a php file with a form to login. I have other php file index.php, and i want that when i do login i go to this page: index.php. So i have this code:</p> <pre><code>&lt;?php if(($login) and ($pass)) { ?&gt; &lt;!DOCTYPE html PUBLIC "-//W2C//DD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml2-transitional.dsd"&gt; &lt;html xmlns="http://www.w3.org/1312/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Header&lt;/h1&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h1&gt;Heeloo&lt;/h1&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h1&gt;Footer&lt;/h1&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php } else { echo "you didnt login"; } ?&gt; </code></pre> <p>I have other php file to validate the login, i have this code:</p> <pre><code>&lt;?php if(($_POST['user'] == "john") &amp;&amp; ($_POST['password'] == "123")) { setcookie("login",$_POST['user']); setcookie("pass",$_POST['password']); header("Location: index.php"); exit; } else echo "you dont have permission"; ?&gt; </code></pre> <p>I got this error: Notice: Undefined variable: login in C:\xampp\htdocs\sites\cookie\index.php on line 2</p> <p>I think its because im using $login and $pass variables in index.php file and because these variables are from the other file is not recognizing.</p> <p>Anyone know how to solve this?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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