homepage Welcome to WebmasterWorld Guest from 54.161.166.171
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Validation Errors
I know why, how to fix?
andmunn




msg:564175
 4:26 am on Apr 16, 2004 (gmt 0)

I have just about completed my whole sight, validated by pages, when alas, the header/footer php includes in all my pages don't validate because of 5 links i just added, all which include certain codes. These links are all part of a script i have running on the site.

To be more exact, I have 5 links that are causing these errors because the links have a variety of "signs" in them, for example, teh "&" seems to be causing particular problems. I get this error:

----------
"Line 167, column 118: cannot generate system identifier for general entity "place_ad" "
----------

followed by the following errors in sequence:

----------
Line 167, column 118: general entity "place_ad" not defined and no default entity (explain...).

Line 167, column 126: reference to entity "place_ad" for which no system identifier could be generated

Line 167, column 117: entity was defined here
----------

Any suggestions how to solve this problem? These links are causing me much needed headache, but they shouldn't be too hard to fix because they are solely located in the header/footer php includes. Any advice?

 

Purple Martin




msg:564176
 5:19 am on Apr 16, 2004 (gmt 0)

Try replacing the special characters with the codes for those characters.

For example, for & use either & or & (I can't remember offhand which is best, experiment and see which validates and still works).

BjarneDM




msg:564177
 8:06 am on Apr 16, 2004 (gmt 0)

I'm avoiding the '&' problem entirely by using ';' instead.

You'll have to modify php.ini slightly thus:

arg_separator.output = ";"
arg_separator.input = ";&"

or in your httpd.conf or .htaccess file:

php_value arg_separator.output ";"
php_value arg_separator.input ";&"

andmunn




msg:564178
 1:24 pm on Apr 16, 2004 (gmt 0)

Thanks for the solutions, i'm going to try these workarounds and see what happens.

BJarneDM, i have access to my .htaccess file, if I code the following:

php_value arg_separator.output ";"
php_value arg_separator.input ";&"

Will it affect my script? What is this esentially telling php to do? I'm a little confused. Also, does this mean i shoudl go through my link and replace all the instances of & with ";"?

Thanks,
Andrew.

VirtualOdin




msg:564179
 2:30 pm on Apr 16, 2004 (gmt 0)

I had just the same problem. My solution, no idea how good!, was to pass just the id which was a reference to a MySQL record and then extract the rest from the database once the new page had loaded. It felt as though it would be slower, but it isn't. Of course it did help that I was working with a set of database fields anyway.

The other trick I have used is hidden form fields, because the values of these transfer automatically to the next page, you just grab the variable in the next page when you need using the form field name.

Tim
<Sorry, no personal URLs. See TOS [webmasterworld.com]>

[edited by: tedster at 8:29 pm (utc) on April 16, 2004]

BjarneDM




msg:564180
 3:02 pm on Apr 17, 2004 (gmt 0)

Will it affect my script? What is this esentially telling php to do? I'm a little confused. Also, does this mean i shoudl go through my link and replace all the instances of & with ";"?

It shouldn't affect your script adversely. You'll want to replace '&' with ';' in your URLs, but you can take it easy, as the instructions given allows you to use both '&' and ';' But you'll get rid of the '&' versus '&amp;' problem in the URLs when replacing all instances of '&' with ';'

andmunn




msg:564181
 12:13 am on Apr 19, 2004 (gmt 0)

just a quick question - i did what you suggested, worked like a charm...then i also tried a different variation.

I simply took all the "&"'s out of the URLs, and the script worked fine. Is it ok if i just keep it like this? Or do you think this would advertisely affect my script.

For example, originally it was:

classifieds.cgi?session_key=;place_ad=on

Now it is:

classifieds.cgi?session_key=place_ad=on

Do you think this will work ok? it seems to work fine on my end? Does this make sense?

Thanks,
Andrew.

BjarneDM




msg:564182
 7:04 am on Apr 19, 2004 (gmt 0)

I'll advise against leaving out the divider.
Leaving it out is a sure way to get into trouble at some time.

The case you are referring is special in that session_key has no value.
But what happens when it does get a value? How is the script to destinguish between where the value of session_key stops and the name of the next parameter starts without a divider? Implicit in your example you do have the divider as the '=' is used for that because session_key has no value.

andmunn




msg:564183
 1:01 pm on Apr 19, 2004 (gmt 0)

Thank you BjarneDM,

Your expanations are superb. Personally, I just like seeing "why" certain things work. I guess i will re-instate your notes in the .htaccess, and restore the "placeholders" as you put it.

My question is? are both ";" and "=" considered placeholders? If so? why do i need both?

I hope this isn't become tedious, but this is just something i'm a litle confused about. And i enjoy figuring out how a script works.

THanks again for the help, it really is appreciated.

Andrew.

grahamstewart




msg:564184
 6:57 pm on Apr 20, 2004 (gmt 0)

Purple Martin's answer seems the most useful.
To expand on it a little....

Valid HTML should not contain the & symbol unless it is being used to insert a special character/entity (such as &gt; or &lt;) to insert the & character itself you must use &amp;

So, this is incorrect...
<a href="/edposts.cgi?action=reply&forum=21&discussion=7719">Show question & replies</a>

The correct way is...
<a href="/edposts.cgi?action=reply&amp;forum=21&amp;discussion=7719">Show question &amp; replies</a>

andmunn




msg:564185
 8:25 pm on Apr 20, 2004 (gmt 0)

Will having "&amp" in my code have an advese effect on my links though? Or should they just keep working like normal?

grahamstewart




msg:564186
 9:06 pm on Apr 20, 2004 (gmt 0)

Your links will work as normal.

grahamstewart




msg:564187
 9:12 pm on Apr 20, 2004 (gmt 0)

See also [htmlhelp.com...]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved