Drezek Posted October 11, 2009 Share Posted October 11, 2009 im having trouble with this php script <?php if (isset($_POST['username']) { echo "fsaf"; } else { echo "<form name="login" method="post" action="index.php">"; echo "<input name="username" type="text" id="username">"; echo "<font color="#A4A4A4"><h3><center><bold>PASSWORD</bold></center></h3></font>"; echo "<input name="password" type="password" id="password"><br>"; echo "<center><input type="submit" name="Submit" value="Login"></form></center>"; } ?> it saids theres a parse error but i cant find any problem with my script is there a special way i should be echoing html data Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/ Share on other sites More sharing options...
merylvingien Posted October 11, 2009 Share Posted October 11, 2009 <?php if (isset($_POST['username']) { echo "fsaf"; } else { echo "<form name="login" method="post" action="index.php">"; echo "<input name="username" type="text" id="username">"; echo "<font color='#A4A4A4'><h3><center><bold>PASSWORD</bold></center></h3></font>"; echo "<input name="password" type="password" id="password"><br>"; echo "<center><input type="submit" name="Submit" value="Login"></form></center>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934814 Share on other sites More sharing options...
sasa Posted October 11, 2009 Share Posted October 11, 2009 try <?php if (isset($_POST['username']) { echo "fsaf"; } else { echo "<form name=\"login\" method=\"post\" action=\"index.php\">"; ... you must escape " inside " Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934815 Share on other sites More sharing options...
Drezek Posted October 11, 2009 Author Share Posted October 11, 2009 i tried both solutions for some reason im still getting a parse error Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934822 Share on other sites More sharing options...
Drezek Posted October 11, 2009 Author Share Posted October 11, 2009 Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\game\index.php on line 33 <?php if (isset($_POST['username']) { <---- line 33 echo "fsaf"; } else { Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934823 Share on other sites More sharing options...
cags Posted October 11, 2009 Share Posted October 11, 2009 You open one bracket for if and one for isset, but you only close one bracket at the end of the line. Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934824 Share on other sites More sharing options...
Drezek Posted October 11, 2009 Author Share Posted October 11, 2009 so what do i do? maybe somethings wrong with my php and mysql installation <?php $blah= 1; if ($blah= 1) { echo "aasfk"; } else { echo "blah"; ?> im getting this for that line of code Parse error: syntax error, unexpected $end in C:\xampp\htdocs\sandbox\index4.php on line 10 Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934828 Share on other sites More sharing options...
cags Posted October 11, 2009 Share Posted October 11, 2009 Close the other set of brackets... if (isset($_POST['username'])) Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934830 Share on other sites More sharing options...
Drezek Posted October 11, 2009 Author Share Posted October 11, 2009 alright i got it its all working now man im such a newb Quote Link to comment https://forums.phpfreaks.com/topic/177299-simple-php-problem/#findComment-934831 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.