Re: This crazy code works, but is this the correct and elegant way on 4.21 ?
| From: | Matt Parlane | Date: | Mon, 24 Jun 2002 08:41:25 +0000 |
| Subject: | Re: This crazy code works, but is this the correct and elegant way on 4.21 ? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-14365@lists.php.net to get a copy of this message | ||
Hiya...
This probably isn't really the right place to discuss this kind of thing,
but to be pedantic, you probably shouldn't have content (like the form tag)
after your </html> tag - it's just not well-formed HTML.
You could of course argue that you probably shouldn't have the "Select one
site to go " text in a php block, but instead just write it out using html -
but that's fairly over the top. oh - and you should have all your html tags
in lower case, otherwise it's not xhtml/xml compliant... You did ask
about elegance.... :)
Matt
Nicely formatted code:
<?php
if (isset($_POST['location']) AND $_POST['location'] != "" &&
$_POST['location'] != "none")
{
header("Location: ".$_POST['location']);
exit;
}
?>
<html>
<body>
Select one site to go:
<br />
<form method="POST" action="">
<select name="location" size="1">
<option value="none">None</option>
<option value="http://www.microsoft.com/">Microsoft</option>
<option value="http://www.altavista.com/">Altavista</option>
<option value="http://php.net/">Php.net</option>
</select>
<input type="submit" value="GO" />
</form>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Saci" <nospam@bol.com.br> wrote in message
news:20020624080940.68642.qmail@pb1.pair.com...
> <?php
> if (isset($_POST['location']) AND $_POST['location'] != "" AND
> $_POST['location'] != "none")
> {
> header("Location: ".$_POST['location']);
> exit;
> }
> else ?>
> <html>
> <body>
> <?php echo "Select one site to go ";?>
> </body>
> </html>
> <FORM method = "POST" action ="">
> <SELECT name = "location" size = "1">
> <OPTION value = "none">None</OPTION>
> <OPTION value =
> "http://www.microsoft.com/">Microsoft</OPTION>
> <OPTION value =
> "http://www.altavista.com/">Altavista</OPTION>
> <OPTION value =
> "http://php.net/">Php.net</OPTION>
> </SELECT>
> <Input type = "submit" Value = "GO"></FORM>
>
>
>