The HTTP_REFERER is sent by the client as part of the request, so there is no guarantee that it will be available (it's a form of user input and can't be trusted). You should first check to make sure that it is set before trying to echo it (a simple if statement would handle this).
On Tue, Sep 30, 2008 at 10:13 PM, Matthew Ishii <[EMAIL PROTECTED]>wrote: > Hello all, > > I am not sure if this has been brought up before (though most likely > it has) however I will anyway, I am having issues validating my pages > against the W3C webstandards for proper HTML markup. I am using the > XHTML1_STRICT Doctype. > > It seems like the phtml webpage format is having difficulties working > with the standards, for example, I have a 'back' link that is using > the SERVER 'HTTP_REFERER' variable to direct users to the last visited > page. When I attempt to validate the page with the following markup, > I receive the following errors: > > Markup - > > <p class="padded_paragraph"><a href="<?php echo > $_SERVER['HTTP_REFERER'] ?>" class="bold">Back</a></p> > > Error(s) - > > Line 92, Column 37: character "<" is the first character of a > delimiter but occurred as data. > > Warning Line 93, Column 9: character "<" is the first character of a > delimiter but occurred as data. > > <b>Notice</b>: Undefined index: HTTP_REFERER in > <b>/home1/ioforgec/zend/applic > > What I find strange is the notice, that the validation service catches > in the source, but when viewed by me in the browser and when viewed in > the post-rendered source I dont see such a notice. I suppose the > HTTP_REFERER is not set for a robotic user, which is what the > validation service must be manifesting as to my application. But how > can I prevent this from causing the page not to validate? > > If anyone would like to take a look at all the errors, just simply > visit this link: > > http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ioforge.com%2Fservices%2Fclientservices&charset=(detect+automatically)&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.591<http://validator.w3.org/check?uri=http%3A%2F%2Fwww.ioforge.com%2Fservices%2Fclientservices&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.591> > > Bottom line is I suppose it doesnt matter whether I validate or not, > so dont think im hung up on it, but it should, I think. And I would > like to .. > > Anyway, I appreciate anyone's suggestions or insight into this matter. > > Thanks, Matthew Ishii > -- Bradley Holt [EMAIL PROTECTED]
