unable to send from javascript to php -


I am creating a dynamic form I am using the following javascript

  var Labels = []; Function add (type) {var element = document.createElement ("input"); Var label = prompt ("Enter name for label", "label"); Labels.push (label); warning label); Document.getElementById ('raj') innerHTML = document.getElementById ('raj') innerHTML + label .. Element.setAttribute ("type", type); Var Rohit = document.getElementById ("Raj"); Rohit.appendChild (element); Document.getElementById ('raj') innerHTML = document.getElementById ('raj') innerHTML + "
" .. } Function add1 (type) {var element = document.createElement ("input"); Var label = prompt ("Enter name for label", "label"); Document.getElementById ('Secrets'). InnerHTML = document.getElementById ('raj'). InnerHTML + label + "::"; Element.setAttribute ("type", type); Var no = prompt ("Total number of fields in radio buttons"); Labels.push (label); warning label); (Var i = 1; i & lt; = no; i ++) for {var val = prompt ('enter value'); Document.getElementById ('Secrets'). InnerHTML = document.getElementById ('raj'). InnerHTML + val + ""; Var Rohit = document.getElementById ("Raj"); Rohit.appendChild (element); } Document.getElementById ('Secrets'). InnerHTML = document.getElementById ('raj'). InnerHTML + "
"; } Add2 (type) function {var element = document.createElement ("textArea"); Var label = prompt ("Enter name for label", "label"); Document.getElementById ('raj') innerHTML = document.getElementById ('raj') innerHTML + label .. Element.setAttribute ("type", type); Labels.push (label); warning label); Var col = prompt (Enter the number of columns'); Element.setAttribute ("column", col); Var line = prompt ('enter number of rows'); Element.setAttribute ("lines", line); Var Rohit = document.getElementById ("Raj"); Rohit.appendChild (element); Document.getElementById ('raj') innerHTML = document.getElementById ('raj') innerHTML + "
" .. } Function callfunc () {var http = new XMLHttpRequest (); Var Name = Prompt ('Enter the name of the form'); // var name = "Rohit"; Warning (name); Var s = document.getElementById ('raj'). InnerHTML; Warning (s); Http.open ("POST", "index1.php? Name" + name, true); Http.onreadystatechange = function {if (http.readyState == 4 & amp; http.status == 200} {Warning ('SFSF'); Warning (responseText);}} Http.send (); Description is false ;}

And then I am using this code in the following code

  
id = "menu" style = "height: 200px; width: 100px; float: left; "gt; & gt; input type =" button "value =" text field "onclick =" add ('text') "& gt; & lt; br / & gt; & Lt; input type = "button" value = "radio button" onclick = "add1 ('radio')">
input type = "button" value = "check box "Onclick =" add1 ('checkbox') ">

& lt; inpu Type = "button" value = "text field" onclick = "add2 ('textarea')">
= "content" style = "Height: 200px width: 400px; float: left;" & gt; form action = "index1.php" onsubmit = "callfunc ()" & gt; & lt; span id = "raj" & gt; ; & Lt; / span & gt; & lt; input type = "submit" value = "submit" & gt; & Lt; / Div & gt;

But when I'm clicking on submit it is not naming on index1.php? Name = but its index 1 This means that I want to post PHP data from Javascript but I am not able to do this with the script. What should I do ??


Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -