How To Submit Jquery Duplicate Fields Form with PHP

Hello, programmers? Hopefully, all of you are waiting for my new updates as usual. So let's move to forwarding a new post of you which I decided to publish today. In this tutorial post, I will teach you how to submit jquery clone/duplicate values to form with PHP

You know PHP is a very ordinary and popular programming language for creating any dynamic in the web application. Depend on my past through in this post you get just an awesome application with codes demo.
Read Also:
1. 10 Windows Run Commands For Quickly Access Your Computer
2. How To Make Flash Effect Image Loading With Jquery
3. How To Make Chatting Application with Jquery and Ajax
4. Games With HTML Codes: Make A Snake Game With Notepad
Submit Jquery Duplicate Fields Form with PHP, JavaScript, Form

Submit Jquery Duplicate Fields Form with PHP


Javascript Codes
Here is javascript code appear. Input text name hobby[] is the array. 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script
type="text/javascript" src="reCopy.js"></script>
<script type="text/javascript">
$(function(){
var removeLink = ' <a class="remove" href="#" onclick="$(this).parent().slideUp(function(){ $(this).remove() }); return false">remove</a>';
$('a.add').relCopy({ append: removeLink});
});
</script>
//HTML code
<form method="post" action="clonesubmit.php">
<p class="clone"> <input type="text" name="hobby[]" class='input'/></p>
<p><a href="#" class="add" rel=".clone">Add More</a></p>
<input type="submit" value=" Submit " />
</form>
clonesubmit.php
Here are contained simple PHP Code that extracting array hobby[] values.
<?phpif($_POST['hobby'])
{
$array=$_POST['hobby'];
foreach($array as $hobby)
{
if(strlen($hobby)>0)
{
$sql=mysql_query("insert into hobbies(hobby)values('$hobby')");
}
}
}
?>
Hopefully, you will be able to submit jquery duplicate fields form with PHP. If have any question about this post ask me via the comment section and share this post in social media with nearby friends. 

About luthfar rahman

Luthfar Rahman is a founder of "Guide to Blogging and Tech" ,He is a Blogger and Studying CSE at "North South University".Follow me on Facebook ,Google+ and Twitter.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment