Reply to PHP help with Control Structure

Your name:

Reply:


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>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация