Jump to content

Please help!


kir

Recommended Posts

Please help! the code does not generate any errors but when I view it on the server (web browser) it shows the error:   Parse error: syntax error, unexpected 'session_start' (T_STRING) in E:\Applacations\wamp\www\QAM\login.php on line 3

Code is below:

------------------------------------------------------------------------------------------------------------------------------------

 

 

<?php

error_reporting (E_ALL ^ E_NOTICE)

session_start();

 

?>

<!DOCTYPE html PUBLIC>

    <html>

        <head>

            <title>Login</title>

        </head>

<body>

    <?php

    

    $form = "<form action='./login.php' method='post'>

    

    <table>

    <tr>

        <td>Username:</td>

        <td><imput type='text' name='user' /></td>

    </tr>

    <tr>

        <td>Password:</td>

        <td><imput type='password' name='password' /></td>

    </tr>

    <tr>

        <td></td>

        <td><imput type='submit' name='loginbtn' value='Login' /></td>

    </tr>

    </tr>

    </table>

    </form>";

    

   if ($_POST['loginbtn']){

       $user = $_POST['user'];

       $password = $_POST['password'];

       

       if ($user){

         if ($password){

         echo "$user - $password <hr /> $form";

         } 

         else

            echo "You must enter your password. $form";

       }

       

       else

            echo "You must enter your username. $form";

   }

   

    else

        echo $form;

    

    

    

    ?>

 

</body>

</html>

Link to comment
https://forums.phpfreaks.com/topic/286999-please-help/
Share on other sites

You need to add another for error checking to actually show you them.

 

 ini_set('display_errors', '1');
 

This will show the error types that you selected in the previous line on your screen.  Be sure to turn this off before putting into production.

 

And then to correct your first error:  The message is telling it doesn't expect to see the "session_start();" line.  That's because you didn't finish the line above it.  Needs a semi.....

 

In the future - you'll get better response if you use a topic title that better describes your problem - please help is just so newbie-ish.

Link to comment
https://forums.phpfreaks.com/topic/286999-please-help/#findComment-1472733
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.