S3C Posted April 30, 2008 Share Posted April 30, 2008 Hello all, I'm trying to make a simple app that asks me for my username, and the redirects me to it on a website. Here's my code: <? if ($_POST['website']) { header("Location: http://". $_POST['website'] . newgrounds.com) } ?> <html> <head> <title> Welcome </title> </head> <body> <form action="welcome.php" method="post"> Enter username: <input type="text" name="website" /> </body> </html> I get a parse error on line 4 and I dont understand why. Parse error: syntax error, unexpected '}' Thanks for help! Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/ Share on other sites More sharing options...
tdpaxton Posted April 30, 2008 Share Posted April 30, 2008 Try this... <? if ($_POST['website']) { header("Location: http://". $_POST['website'] . "newgrounds.com") } ?> <html> <head> <title> Welcome </title> </head> <body> <form action="welcome.php" method="post"> Enter username: <input type="text" name="website" /> </body> </html> Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530466 Share on other sites More sharing options...
S3C Posted April 30, 2008 Author Share Posted April 30, 2008 Hmm..I still get the same error..but I appreciate the prompt response! Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530468 Share on other sites More sharing options...
DJTim666 Posted April 30, 2008 Share Posted April 30, 2008 Change this.. header("Location: http://". $_POST['website'] . "newgrounds.com") To this.. header("Location: http://". $_POST['website'] . "newgrounds.com"); -- DJ Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530470 Share on other sites More sharing options...
S3C Posted April 30, 2008 Author Share Posted April 30, 2008 Thank you! It seems to work, but now its not displaying the webpage...How do I solve this?? (sorry if I should start a new topic) Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530475 Share on other sites More sharing options...
derrick1123 Posted April 30, 2008 Share Posted April 30, 2008 Can you give us the code of the page you have now? Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530477 Share on other sites More sharing options...
S3C Posted April 30, 2008 Author Share Posted April 30, 2008 Appreciate it! <? if ($_POST['website']) { header("Location: http://". $_POST['website'] . "newgrounds.com"); } ?> <html> <head> <title> Welcome </title> </head> <body> <form action="welcome2.php" method="post"> Enter username: <input type="text" name="website" /> </body> </html> Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530479 Share on other sites More sharing options...
tdpaxton Posted April 30, 2008 Share Posted April 30, 2008 So if someone were to enter "test" in the username field and press enter, they should be redirected to: http://testnewgrounds.com ? Or do you want them directed to http://test.newgrounds.com ? Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530488 Share on other sites More sharing options...
S3C Posted April 30, 2008 Author Share Posted April 30, 2008 that was the problem, thanks a lot! Link to comment https://forums.phpfreaks.com/topic/103589-solved-parse-error/#findComment-530511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.