Page 1 of 1

how to get the values of textboxes

Posted: Wed May 28, 2014 2:35 am
by snehathomas184
I am using following code to add dynamic arrays...using this how to get the value of textboxes..i need to insert the textbox value to mysql database using php

Code: Select all

<script>
  var counter=1;
  function generateRow() {
    var count="<font color='red'>"+counter+"</font>";
    var temp ="<p>&nbsp;&nbsp;&nbsp;&nbsp;<div class='_25'><input type='textbox' id='textbox' name='stop"+counter+"' placeholder='Stop Name'></input></div>&nbsp;&nbsp;&nbsp;<div class='_25'><input type='textbox' id='textbox' name='add"+counter+"' placeholder='Address'></input></div>&nbsp;";

var newdiv = document.createElement('div');
    newdiv.innerHTML = temp + count;

    var yourDiv = document.getElementById('div');
    yourDiv.appendChild(newdiv);
    counter++;
  }

</script>
 <div id="div">
 </div>

 <p>&nbsp;</p>
 <div class="_25">
    <p>
      <input type="button" name="button" class="button red" id="button" value="Add"  onclick="generateRow() "/></a>
      <label>
        <input type="submit" name="save" id="save" value="Submit" onClick="getValue()">
      </label>
    </p>
 </div>

Re: how to get the values of textboxes

Posted: Wed May 28, 2014 5:56 pm
by Christopher
snehathomas184 wrote:i need to insert the textbox value to mysql database using php
You can submit the form to a PHP script and get the values from $_POST, or use Ajax to pass the values to a PHP script.