I want to send an get data from this way and creat input whit this jquery and post to php page and get result but the problem is :
Warning: Invalid argument supplied for foreach() in
jQuery
$('#ss').live('click', function () {
$("#main_login").html("<center>waiting plaese . . . .</center>");
var arr = $("#myInputs").val();
$.ajax({
type: 'POST',
url: 'process.php',
data: "myInputs=" + arr,
success: function (data) {
$('#main_login').html(data)
}
});
});
$(function () {
var scntDiv = $('#p_scents');
var i = $('#p_scents p').size() + 1;
$('#text').live('click', function () {
$('<p><input type="text" id="myInputs" size="20" name="myInputs[]" value="" placeholder="Input Value" /> <a href="#" id="rtext">Remove</a></p>').appendTo(scntDiv);
i++;
return false;
});
});
HTML
<a href="#" id="text">add</a><br>
<div id="p_scents">
<p><label for="p_scnts"><input type="text" id="myInputs[]" size="20" name="myInputs[]" value="" placeholder="Input Value" /></label></p>
<div id="main_login"></div>
php
$name = $_POST['myInputs'];
foreach( $name as $key => $n ) {
print "The name is ".$n." and email is , thank you<br>";
}