-2

For a jQuery Datatables grid, I'm trying to figure out how I can add a onclick event to the delete link (when I need a double quoted variable string with single and double quotes inside it).

onlick="return confirm('are you sure?')"

$nestedData[] = "<a href=users_delete.php?id=" . $row['id'] . "> Delete </a>";  

Since an onlick event needs both single and double quotes to declare it, how to you get an onclick event added to a HREF that's stored in a variable?

thanks!

Reno
  • 2,962
  • 9
  • 41
  • 68

1 Answers1

1

You are looking for character escaping:

$a = "this is \"quoted\"";
$b = 'this is \'quoted\'';
$c = 'this is "quoted"';
$d = "this is 'quoted'";
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141