Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.