Ampersands in Attribute Values

windows

Guest
hi guys,

the last thing i have to validate on my page are the query strings.

now i changed all the '&' to '&' and it didnt change a thing when i tried to validate it.

i validated this page: <!-- m --><a class="postlink" href="http://www.modelaircraft.co.nz/commercial.php">http://www.modelaircraft.co.nz/commercial.php</a><!-- m --> (<!-- w --><a class="postlink" href="http://www.modelaircraft.co.nz/commercial.php">www.modelaircraft.co.nz/commercial.php</a><!-- w -->)

or the validated link:http://validator.w3.org/check?uri=http%3A%2F%2Fwww.modelaircraft.co.nz%2Fcommercial.php

and got 13 errors.

for example

...m1" method="post" action="cart.php?action=add_item&id=68&qty=1"/>

changed the &'s and still get 13 of the same errors. am i missing something here? is it the &'s that is giving me problems?

also: when you look at the source code, all the '&' s come out as a normal '&'? right?

thanx guysYou need to replace the &'s in the links to & ;)cart.php?action=add_item&id=<?php echo $row["itemId"]; ?>&qty=1" (the '&amp's do not show up?)

i did change the '&' to '&amp';

this is what it looks like in dreamweaver. thats why i asked if it looks like a normal '&' after you have uploaded it and look at the source code.

thanxYes, it does look like a normal &. There is obviously something going on during the transfer that is converting them back, but I can't imagine what it could be.Try this, perhaps:

<?php
echo sprintf("<form name='fname' method=post action='cart.php?%s'>\n",
urlencode("action=add_item\\&id=${row["itemId"]}\\&qty=1");
?>Dreamweaver seems to automatically convert HTML entities to the actual characters they represent when you either upload the files or save them. I've never tried setting the DW FTP client to upload files in binary mode, thinking maybe uploading them in ASCII mode is what causes Dreaweaver to change characters around.

I've searched on the Macromedia Dreamweaver forum for a fix to no avail. And believe me, you've not alone with this problem. The fix is to not use Dreamweaver at this point.thanx guys for your help!

i dont use the ftp client in DW. just to code sometimes. i will try in notepad and upload with seperatye ftp client hopefully that will work!hi guys thanx for all your help, it was DW changing it back to &.
did it in notepad and worked fine! i guess now cant do any more changes in DW or it will change it back again?It's against the union rules to help you keep using Dreamweaver in the same way that it's against the rules for doctors to help smokers keep smoking but if you promise to only use to get you through while you are learning HTML...

The guy who wrote the old HTML 3.2 Specification, Dave Raggett, also wrote a little application that tidies up some of what we now call "well formedness errors." It's called HTML Tidy (<!-- m --><a class="postlink" href="http://tidy.sourceforge.net/">http://tidy.sourceforge.net/</a><!-- m -->) though it is now maintained by a group of volunteers. I think that you will find that it changes those &s back again to &s.Originally posted by Charles
It's against the union rules to help you keep using Dreamweaver in the same way that it's against the rules for doctors to help smokers keep smoking but if you promise to only use to get you through while you are learning HTML...

What is a good program to use (besides Notepad) when Dreamweaver just seems to not cut it any more? It was a good tool to help me learn, but I need to find something a little better. Any suggestions?Originally posted by heavenly_blue
What is a good program to use (besides Notepad) when Dreamweaver just seems to not cut it any more? It was a good tool to help me learn, but I need to find something a little better. Any suggestions? Actually, I've used DreamWeaver for a while now and had never had any problems with Ampersands. The only problem I've encountered is the automatic URI modifications it makes if you save a file to a different directory. Anyway, another good editor would be HTML-Kit (<!-- m --><a class="postlink" href="http://www.chami.com/html-kit/">http://www.chami.com/html-kit/</a><!-- m -->). It seems to format HTML, CSS, JS, and PHP fairly decently :)Originally posted by heavenly_blue
Any suggestions? Notepad. But once you know what you are doing you might find HTML Kit (<!-- m --><a class="postlink" href="http://www.chami.com/html-kit/">http://www.chami.com/html-kit/</a><!-- m -->) of some use.I've been using HTML-Kit awhile now, too. I got it because it has context-sensitive colors, supports PHP code, and is priced right (free). It also seems to work quite well.
 
Back
Top