I'm having problem on single and double quote in window location in javascript. I have this data in my database test's data
and i use this in window location like this :
function test(name){
window.location.href = "http://localhost/test/tests.php?name="+ name;
}
this is my php code:
$name = "test's data";
echo '
<button onclick="return test(\''. $name .'\')" class="btn btn-danger">TEST</button>
';
and if you check it in development tool it would be like:
<button onclick="return test('test's data')" class="btn btn-danger">TEST</button>
i know my error is the quotation in test('test's data'). How can i fix my quotations in function so it will redirect you to another page test.php?