Re: Passing string variable to HTML TITLE tag fails within Netscape but works well within IE.
| From: | Baroiller Pierre-Emmanuel | Date: | Wed, 16 Oct 2002 13:59:14 +0000 |
| Subject: | Re: Passing string variable to HTML TITLE tag fails within Netscape but works well within IE. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22459@lists.php.net to get a copy of this message | ||
your html is wrong...
you must write :
<html>
<head>
<title><?php echo $title ?> </title>
</head>
</html>
With the "head" tag, IE & Netscape will display your title correctly.
Regards.
P.E.
"Darrian Walker" <dwalker@healthyproductsplus.com> a écrit dans le message de news: 01c274b9$2a10a1a0$d07623c7@b...
Passing string variable to HTML TITLE tag fails within Netscape but work
well within IE.
I have a single page consisting of inventory items to be sold. When an item
is selected, it passes the product name to a DETAIL page as part of the
TITLE tag for the DETAIL page. My problem is: Netscape does not like the
SPACES between the text and refuses to display the DETAIL page.
Initially, I thought there might be some way to parse the string and add the
ascii code for SPACE, but I wasn't sure if I was on the right track. Does
anyone have a proven solution to this problem?
I thought the pseudo code might look something like this:
<?php
function
parse_and_change(&grab_string){
$string_holder=$grab_string;
while stepping through the characters in this $string_holder
{ if character = " " (or some other representation)
replace it with something that doesn't
scare netscape or title tag
}
return $string_holder;
}
?>
<?php
if (isset($HTTP_GET_VARS["itemname"])) {
$title = (parse_and_change($HTTP_GET_VARS["itemname"] ));
}else{
$title="Generic Product Title";
}
?>
<html>
<title><?php echo $title ?> </title>
</html>