using & in an html code
Posted: 31 May 2013 12:45
Hi there I have the following html "replacer" script that I use many times a day:
It works great except for one problem - when & is entered in either field:
replace & with -
nothing changes
ball&chain remains ball&chain
replace - with &
- is replaced with nothing
ball-chain becomes ballchain
I didn't really write the code so I don't know how to fix it but am I right in thinking it has something to do with these two lines of code:
Thanks in advance for any help :-)
Code: Select all
"Replacer|:rename"
end(getinfo("CountSelected") < 1), "Nothing selected!";
$html = urldecode(html('
<html>
<body style="font-family:arial;">
<form method="get" action="xys:">
Replace This: <INPUT TYPE="TEXT" NAME="Search" SIZE="60" VALUE=""><BR>
With This: <INPUT TYPE="TEXT" NAME="Replace" SIZE="60" VALUE=""> <BR>
<p align="left"><INPUT type="submit" name="Rename" value=" Replace " ></p>
</form>
</body>
</html>',"480", "260", "Renamer"));
$Search = gettoken($html, "1", "&");
$Replace = gettoken($html, "2", "&");
$Search = gettoken($Search, "2", "=");
$Replace = gettoken($Replace, "2", "=");
rename s, "$Search/$Replace";
replace & with -
nothing changes
ball&chain remains ball&chain
replace - with &
- is replaced with nothing
ball-chain becomes ballchain
I didn't really write the code so I don't know how to fix it but am I right in thinking it has something to do with these two lines of code:
Code: Select all
$Search = gettoken($html, "1", "&");
$Replace = gettoken($html, "2", "&");