shedokan Posted June 9, 2007 Share Posted June 9, 2007 I'm always getting a Parse error: "syntax error, unexpected $end" when I'm opening y php file here is the source code: <html> <body> <?php $pass = $_POST[pass]; if (isset($pass)) { echo 'You must enter a password:<br><form name="input" action="the_name_of_the_file.php" method="post"><input type="text" name="pass"><input type="submit" value="Submit"></form>'; } elseif ($pass!=pass) { echo 'You entered a wrong password:<br><form name="input" action="the_name_of_the_file.php" method="post"><input type="text" name="pass"><input type="submit" value="Submit"></form>'; } elseif ($pass=="pass") { */connect to mysql and then coose a database/* $name = $_POST[name]; $link = $_POST[link]; $ctg = $_POST[ctg]; $img = $_POST; $bg = $_POST[bg]; $date = date('Y-m-d'); echo 'some form'; $insert="some my sql quiery goes here"; mysql_query($insert,$db); ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/54864-solved-why-do-i-get-the-parse-error-syntax-error-unexpected-end/ Share on other sites More sharing options...
chigley Posted June 9, 2007 Share Posted June 9, 2007 <html> <body> <?php $pass = $_POST["pass"]; if (!isset($pass)) { echo "You must enter a password:<br /><form name=\"input\" action=\"the_name_of_the_file.php\" method=\"post\"><input type=\"text\" name=\"pass\"><input type=\"submit\" value=\"Submit\"></form>"; } elseif ($pass != "pass") { echo "You entered a wrong password:<br /><form name=\"input\" action=\"the_name_of_the_file.php\" method=\"post\"><input type=\"text\" name=\"pass\"><input type=\"submit\" value=\"Submit\"></form>"; } elseif ($pass == "pass") { // connect to mysql and then coose a database } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/54864-solved-why-do-i-get-the-parse-error-syntax-error-unexpected-end/#findComment-271327 Share on other sites More sharing options...
shedokan Posted June 9, 2007 Author Share Posted June 9, 2007 thanks!, somehow I tried the same thing exept the: } elseif ($pass != "pass") { it was } elseif ($pass != "pass") { And I tried the "}" for the elseif() but it didn't worked Link to comment https://forums.phpfreaks.com/topic/54864-solved-why-do-i-get-the-parse-error-syntax-error-unexpected-end/#findComment-271329 Share on other sites More sharing options...
taith Posted June 9, 2007 Share Posted June 9, 2007 nah... you were missign the closing } to that elseif() Link to comment https://forums.phpfreaks.com/topic/54864-solved-why-do-i-get-the-parse-error-syntax-error-unexpected-end/#findComment-271330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.