Get values from inputs which are array elements
I'm trying to get values from the form1 inputs in order to make an AJAX call. The $_POST global array is undefined and I'm stuck. Thanks in advance for your help.
Note: <input type="text"
name="AcctFor[]"
R
- <script type="text/javascript" >
// ==============================================
- // produce array of values to send to PHP script for processing database data.
$(document).ready(function(){
$("#form1").submit(function(e){
//e.preventDefault(); // get same undefined $_POST error if this line is un-commented
//alert('Post Info '+$_POST['OrderNo'][0]); // undefined $_POST
alert("Submit prevented"+ $("input[name=OrderNo")][0].val()); HOW TO GET VALUE???
});
});
// =================================================
</script>
</head>
<body>
<div id="wrapper">
<div id="form_div">
<form id="form1" method="post" action="">
<table id="renovationTable" align=left bgcolor='#055584'>
<tr id="row1">
<td><input type="text" name="AcctFor[]" placeholder="Enter AcctFor" required></td><tr></tr>
<td><input type="date" name="InvDate[]" placeholder="Enter InvDate" required></td><tr></tr>
<td><input type="text" name="OrderNo[]" placeholder="Enter OrderNo" required></td><tr></tr>
<td><input type="text" name="DrugNo[]" placeholder="Enter DrugNo" required></td><tr></tr>
<td><input type="text" name="Description[]" placeholder="Enter Description" required></td><tr></tr>
<td><input type="text" name="Cost[]" placeholder="Enter Cost" required></td><tr></tr>
<td><input type="number"" name="ReFills[]" placeholder="Enter ReFills"></td><tr></tr>
</tr>
</table>
<input type="button" onclick="add_row();" value="ADD ROW">
<input type="submit" name="submit_row" value="SUBMIT">
</form>
</div>
</div>
</body>
</html>