From dynamic html form, I submit the social net work user login ids. This works fine but for multiple entries, it is not giving the data input made. The code given below (jquery & form):
$(document).ready(function() {
var max_fields = 10; //maximum input boxes allowed
var wrapper = $(".input_fields_wrap"); //Fields wrapper
var add_button = $(".add_field_button"); //Add button ID
var x = 1; //initlal text box count
$(add_button).click(function(e){ //on add input button click
e.preventDefault();
if(x < max_fields){ //max input box allowed
x++; //text box increment
$(wrapper).append('<div class="k"><input type="text" name="net_work"><input type="text" name="user_login"><input type="text" name="pass_word"/> <a href="#" class="remove_field">X</a></div>'); //add input box
}
});
$(wrapper).on("click",".remove_field", function(e){ //user click on remove text
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});
<form method="post" action="xyz.com.php">
NAME: <input type="text" size="28" name="name" /> <br/>
PLACE: <input type="text" size="28" name="place"> <br/>
MOBILE: <input type="text" size="28" name="mobile"> <br/><br/>
<div class="input_fields_wrap">
NET_WORK USER_LOGIN PASS_WORD
<div class="k"><input type="text" name="net_work"><input type="text" name="user_login"><input type="text" name="pass_word">
<button class="add_field_button">+</button>
</div>
</div>
<input type="submit" name='submit' onclick="show_confirm()" value="SUBMIT">
<input type="reset" value="CLEAR">
</form>
The PHP Code:
<?php
$name = $_POST['name'];
$place = $_POST['place'];
$mobile = $_POST['mobile'];
$net_work = $_POST['net_work'];
$user_login = $_POST['user_login'];
$pass_word = $_POST['pass_word'];
//Email body
$email_body =
"Name: $name\n".
"Place: $place\n".
"Mobile:$mobile\n\n".
"Social_net work name: $net_work\n".
"User_id: $user_login Pass word: $pass_word\n\n";
//Email sending to
// code goes here
?>
Can any body help me in getting the correct code please?
Aucun commentaire:
Enregistrer un commentaire