|  | Posted by Bruce Whealton on 02/06/07 00:17 
Hi,I'm learning PHP, using PHP 5.2.x and can't figure out
 what I am doing wrong with this simple control structure,
 an if-else block. It's an example from a text and it seems
 pretty simple but I get nothing on the page.  The
 form never appears and it should the first time the page is
 called.  It's an example of a multipurpose page where
 the first time it is called, the script uses the form to
 request the users name.  Each time later the page is
 called, the form won't need to be called because the
 variable is later assigned a value.  Here it is, please help...
 see just below...
 Bruce
 
 <body>
 <?php if (isset($_GET['name']) ): ?>
 <p>Your name: <?php echo($_GET['name']); ?></p>
 <p>This paragraph contains a
 <a href="newpage.php?name=<?php echo(urlencode($_GET['name'])); ?>">
 link</a> that passes the
 name variable on to the next document.</p>
 } else {
 /* No name has been provided, so we
 prompt the user for one.  */
 <form action=<?php echo($PHP_SELF)); ?>  METHOD=GET>
 Please enter your name: <INPUT TYPE=TEXT NAME="name">
 <INPUT TYPE=SUBMIT VALUE="GO" >
 </form>
 <?php endif; ?>
 </body>
  Navigation: [Reply to this message] |