kir Posted March 15, 2014 Share Posted March 15, 2014 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> Quote Link to comment https://forums.phpfreaks.com/topic/286999-please-help/ Share on other sites More sharing options...
ginerjm Posted March 15, 2014 Share Posted March 15, 2014 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. Quote Link to comment https://forums.phpfreaks.com/topic/286999-please-help/#findComment-1472733 Share on other sites More sharing options...
kir Posted March 16, 2014 Author Share Posted March 16, 2014 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/286999-please-help/#findComment-1472811 Share on other sites More sharing options...
ginerjm Posted March 16, 2014 Share Posted March 16, 2014 Hopefully i helped Quote Link to comment https://forums.phpfreaks.com/topic/286999-please-help/#findComment-1472812 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.