+1 Reply Bernard.
You can make this look less strange / broken by using template-level control structures, for example, well-formed tags, for example:
<?php if (!isset($_POST['submit'])) { ?> <form method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>"> <label for="age">Enter your age:</label> <input name="age" id="age"> <input type="submit" name="submit" value="Go"> </form> <?php } else { ?> <?php <?php if ($age >= 21) { ?> Come on in, we have alcohol and music awaiting you! <?php } else { ?> You're too young for this club, come back when you're a little older. <?php } ?> <?php } ?>
Pay attention to htmlspecialchars around $_SERVER['PHP_SELF']; - it was a through hole for scripts in the sample code. Plus there was an obvious problem with the apostrophes in the latest echo .
bobince
source share