|  | Posted by Geoff Berrow on 02/06/07 01:18 
Message-ID: <45c7c91f$0$5753$4c368faf@roadrunner.com> from BruceWhealton contained the following:
 
 >    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.
 
 Get a new book.  The following works
 
 
 <body>
 <?php if (isset($_GET['name']) ){ ?>
 <p>Your name: <?php echo($_GET['name']); ?></p>
 <p>This paragraph contains a
 <a href="<?php echo $_SERVER['PHP_SELF']; ?>?name=<?php
 echo(urlencode($_GET['name'])); ?>">
 link</a> that passes the
 name variable on to the next document.</p>
 <?php
 } else {
 /* No name has been provided, so we
 prompt the user for one.  */
 ?>
 <form action=<?php echo $_SERVER['PHP_SELF']; ?>  METHOD="GET">
 Please enter your name: <INPUT TYPE="TEXT" NAME="name">
 <INPUT TYPE="SUBMIT" VALUE="GO" >
 </form>
 <?php } ?>
 </body>
 
 --
 Geoff Berrow  0110001001101100010000000110
 001101101011011001000110111101100111001011
 100110001101101111001011100111010101101011
  Navigation: [Reply to this message] |