Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to display the welcome page after successful log in?
    primarykey
    data
    text
    <p>I am using following code in two different folder like Model and View. In View Folder contain two php file like Login.php and Login_success.php. Controller folder contain the mysql database table field fetch code. When I run below code It can't display the Login_success page. Only the else field <strong>Check Name and password</strong> displayed. These all file combined to out of folder index.php .</p> <p>Here my code :</p> <p><strong>Login.php</strong></p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Login&lt;/title&gt; &lt;link rel ='stylesheet' type = 'text/css' href = 'View/Design.css'&gt; &lt;script&gt; function Validate(){ var x=document.forms["login"]["username"].value; if (x==null || x=="") { alert("First name must be filled out"); return false; } var x=document.forms["login"]["password"].value; if (x==null || x=="") { alert("Password must be filled out"); return false; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name = 'login' method = 'post' action = 'Controller/Controll.php' &gt; &lt;fieldset&gt; &lt;legend&gt;Login&lt;/legend&gt; User Name :&lt;input type = 'text' name = 'username'&gt; Password :&lt;input type = 'password' name = 'password'&gt;&lt;br&gt;&lt;br&gt; &lt;input type = 'submit' name = 'submit' value = 'submit' onsubmit = "return Validate()" &gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Controll.php</strong></p> <pre><code> class Access{ function connection(){ require_once('View/Login.php'); $con = mysql_connect('localhost','root','root'); $db = mysql_select_db('Times_sheet'); $query = mysql_query('select * from Login'); $row = mysql_fetch_array($query); if(isset($_POST['submit'])) { if(($row['UserName']==$_POST['username']) &amp;&amp; ($row['Password']==$_POST['password'])){ require_once("View/Login_Success.php"); } } else{ echo "Check User name and Password"; } } } </code></pre> <p><strong>Index.php</strong></p> <pre><code>require_once('Controller/Controll.php'); class login extends Access{ function getValu(){ require_once('View/Login.php'); } } $Obj = new login(); $Obj -&gt;getValu(); $Obj -&gt;connection(); </code></pre> <p>When I enter the correct user name and password it shoes the empty page. I don't know what mistake I did.</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