...

View Full Version : Having braking problems



JudgementDay
02-18-2012, 07:47 AM
Does anyone know how I can stop this error?


if ($row['size30'] > 0) {
echo '
if (document.forms["form"]["quantity"].value > '.$row['size30'].') {
alert ("Can't add because quantity exceeds availability.");
return false;
}
';
}

The problem is with the apostrophe in the word Can't. Its causing a braking out issue.

JudgementDay
02-18-2012, 07:51 AM
A cheap method:



if ($row['size30'] > 0) {
echo '
if (document.forms["form"]["quantity"].value > '.$row['size30'].') {
alert ("Can'; echo "'"; echo 't add because quantity exceeds availability.");
return false;
}
';
}


Anyone know a more professional method?

JudgementDay
02-18-2012, 08:21 AM
You know what, who cares it works. :)

Resolved.

felgall
02-18-2012, 09:36 PM
The simpler solution would be to replace Can't with Can\'t

JudgementDay
02-19-2012, 06:03 AM
That didn't work.

JudgementDay
02-19-2012, 06:30 AM
Not so, the problem lays else where... I shall report.

JudgementDay
02-19-2012, 06:46 AM
It was working, but the script wasn't being triggered due to an associated name error.

Dormilich
02-19-2012, 10:23 AM
Anyone know a more professional method?
if there are too many 's and "s, I check whether I can use the HEREDOC syntax.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum