[UPHPU] Newbie needs help
John M
johnm_ul at yahoo.com
Fri Jun 10 10:53:21 MDT 2005
Everyone: Thanks for the input so far. I've inserted
$_REQUEST['name'] and I've used $_SERVER["PHP_SELF"].
At this point I'm not getting a blank page anymore.
Right now I'm getting...(after leaving the text box
blank on the html page)
Your name:
This paragraph contains a link that passes the name
variable on to the next document
I get that response no matter what I put into the text
box on the html page. I guess my if/else statement
isn't working right? I'm trying to get a response
that asks me for my name again. I know this is only
supposed to happen when I leave the html text box
blank which is what I've been doing to test this
little exercise in the book I'm reading.
Here is what I have in my php file now (anyone see any
syntax problems there?)....
<?php
$name = $_REQUEST['name'];
if (!isset($name)) {
?>
<!-- No name has been provided, so we
prompt the user for one. -->
<form action="<?=$_SERVER["PHP_SELF"]?>"
method="post">
Please enter your name: <input type="text" name="name"
/>
<input type="submit" value="GO" />
</form>
<?php } else { ?>
<p>Your name: <?=$name?></p>
<p>This paragraph contains a <a
href="newpage.php?name=<?=urlencode($name)?>">link</a>
that passes the name variable on to the next
document</p>
<?php } ?>
__________________________________
Discover Yahoo!
Get on-the-go sports scores, stock quotes, news and more. Check it out!
http://discover.yahoo.com/mobile.html
More information about the UPHPU
mailing list