stijn0713 Posted April 10, 2012 Share Posted April 10, 2012 i dont understand why the it gives me a syntax error when i type this: echo '<h2> <?php echo $_POST['firstname'] ?> gelukt!</h2>'; Apparently, i have to do this: echo '<h2> <?php echo $_POST["firstname"] ?> gelukt!</h2>'; Quote Link to comment Share on other sites More sharing options...
xyph Posted April 10, 2012 Share Posted April 10, 2012 Single quotes: echo '<h2>'.$_POST['firstname'].' gelukt!</h2>'; Double quotes echo "<h2>{$_POST['firstname']} gelukt!</h2>"; Further reading: http://php.net/manual/en/language.operators.string.php http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double Quote Link to comment Share on other sites More sharing options...
Jessica Posted April 10, 2012 Share Posted April 10, 2012 Well for one, you are echoing and then putting php commands inside of that. i don't think you mean to do that. echo '<h2> <?php echo $_POST['firstname'] ?> gelukt!</h2>'; vs echo '<h2>'.$_POST['firstname'].' gelukt!</h2>'; Quote Link to comment 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.