javascript - onclick function is not working -


This is my code, anyone can help me Click the function on the onclick function insert1 ( ); Calling is not calling when clicking on Calling button If I use the script in the head part, then it also does not work.

  & lt; Html & gt; & Lt; Top & gt; & Lt ;? Php $ mode = ""; $ SNO = ""; $ Name = ""; $ Gender = ""; $ Age = ""; If (isset ($ _ request ["mode"])) $ mode = $ _ request ["mode"]; And $ mode = "list"; If ($ mode == "save") {$ sno = $ _ request ['sno']; $ Name = $ _ request ['name']; $ Gender = $ _ request ['gender']; $ Age = $ _ request ['age']; $ Con = mysqli_connect ("localhost", "root", "", "outpost"); Insert $ Sql ​​= "atom (name, gender, age) value ('$ name', '$ gender', '$ age')"; Mysqli_query ($ thief, $ sql); }? & Gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt ;? Php if ($ mode == "LIST") {? & Gt; & Lt; Center & gt; & Lt; Pre & gt; Sno & lt; Input type = "text" name = sno id = sno readonly & gt; & Lt; Br> Name & lt; Input type = text name = name id = name & gt; & Lt; Br> Gender & lt; Input type = text name = gender id = gender & gt; & Lt; Br> Age & lt; Input type = text name = age id = age & gt; & Lt; Br> & Lt; Input type = button onclick = "insert1 ();" Value = insert & gt; & Lt; Br> & Lt; Input type = "button" onClick = "fnsave ();" Class = "button" value = "save" & gt; & Lt; / Center & gt; & Lt ;? Php}? & Gt; & Lt; Script & gt; Function insert1 () {warning ("t"); Var sno = document.getElementById ("snow"). Values; Var name = document.getElementById ("name"). Values; Var gender = document.getElementById ("gender"). Values; Var Age = Document. GetElementById ("Age"). value; Window.location = "file3.php? Sno =" + sno + "& amp; name =" + name + "& gender =" + gender + "age =" + + + age + "and mode =" save " ;}  & lt; / body & gt;   

Your error javascript, this is the reason why this method is not working.

  window.location = "file3.php? Sno = "+ sno +" & amp; Name = "+ name +" & amp; Gender = "+ gender +" age = "+ age +" & amp; Mode = "save";  

should see

  "and mode =" save ";  

should be:

"& amp; Apart from this, @ Bhav has found another error in your Vars, it does not work from JS, but creates an incorrect URL.


Comments

Popular posts from this blog

Active Directory Authenticated Proxy Server with Squid or CNTLM -

java - Can't add JTree to JPanel of a JInternalFrame -

java - @PluginTarget(Node.class) not registering as neo4j plugin -