How to echo this statement to HTML

Ok I have a statement I am trying to echo but it isn’t working for some reason the statement is

 echo "<li><a href='#' onclick='History.pushState({state:null},'article,$id','article'); return false;'>".$row['title']."</a> </li>";

everything after the } is being outputed but not in sequence so my statement doesn’t work in HTML how can I solve this issue


// added a line end to make it easier to read on here

 echo "<li><a href='#' onclick=\\"History.pushState({state:null},'article,$id','article'); 
                      return false;\\">".$row['title']."</a> </li>";

Oh the joys of writing js inside php … Try that instead, if it does not work try looking at the source code of the page.

I’d test this out on a single new test page till the complexity is worked out.

Then repeat using the heredoc syntax for strings - you might find that easier to work with when outputing js.

Thanks will give it a shot.

This works tks alot