I'm writing javascript with php like:
echo '<a class="'.$classTag.'" href="javascript: OpenModalDialog(\''.$MenuItem['table_name'].'\', \''.($MenuItem['where_clause']).'\');"><span>View Data</span></a>';
This results in this:
echo '<a class="'.$classTag.'" href="javascript: OpenModalDialog('input_lijstwerk_401', ' WHERE DATE_FORMAT(Datum, '%Y%m') = '201606'');"><span>View Data</span></a>';
The problem is in the variable: $MenuItem['where_clause'] with the single quotes inside the signature of the openModalDialog: ' WHERE DATE_FORMAT(Datum, '%Y%m') = '201606''
I have tried with json_encode, htmlspecialchars. We are working with PHP7
I hope that someone can help me out this problem.
Thanks,
Nico