php - window location not working javascript -


I have a problem on single and double coat in window space in javascript. I have this data in my database test and I use it in the window's place like this:

  function testing (name) {window.location.href = "http: // localhost / test / Tests.php? Name = "+ name; }   

This is my php code:

  $ name = "test data"; Echo '& lt; Button onclick = "return exam (\ '.name.' '\')" Class = "btn btn-danger" & gt; Test & lt; / Button & gt; ';   

And if you are looking at it in the development tool it will be:

  & lt; Button onclick = "return test ('data of test')" class = "btn btn-danger" & gt; Test & lt; / Button & gt;   

I know that my error exam is quote ('test data'). How can I fix my quotation in the function so that it redirects you to another page at test.php?

Change $ name

  $ name = "test data" ;   

To avoid epostrofy or better, use

  $ name = addslashes ("test data");   

To avoid all special characters.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -