TECK
06-25-2002, 06:10 AM
i need some help to builld a function to automatically replace the " and '.
here it is what i try to do:$ccode[1]='if (!$getperms[\'canviewothers\') {
show_nopermission();
}';
$ccode[2]='New code here...';
maketextareacode('FIND','cc',$ccode[1],'4','100');
maketextareacode('BELOW THIS, ADD','cc',$ccode[2],'10','100');i had to manually add a slash in front and at the end of canviewothers to dont get any parse errors...
what should i use to automatically replace the ' with a \'?
a str_replace should do?
$ccode[1]=str_replace("'","\'",$ccode[1]);
if i do this, i still get parse errors... what is the best aproach to eliminate the \' or \" problem?
thank you for reading this.
here it is what i try to do:$ccode[1]='if (!$getperms[\'canviewothers\') {
show_nopermission();
}';
$ccode[2]='New code here...';
maketextareacode('FIND','cc',$ccode[1],'4','100');
maketextareacode('BELOW THIS, ADD','cc',$ccode[2],'10','100');i had to manually add a slash in front and at the end of canviewothers to dont get any parse errors...
what should i use to automatically replace the ' with a \'?
a str_replace should do?
$ccode[1]=str_replace("'","\'",$ccode[1]);
if i do this, i still get parse errors... what is the best aproach to eliminate the \' or \" problem?
thank you for reading this.