I'm developing a module for my clan, where the user can automatically generate a BBCode formatted text.
As there are multiple groups in our team, i want them also seperated by <h1> Tags
For each Group from $groups there should be an individual amount of clones.
Here's my HTML + JS. Instead of the <h1> there sould be the name of the group from the PHP array $groups=array("Group 1", "Group 2",...)
http://jsfiddle.net/yq2jjn9z/1/ (form.js)
My index.php looks at the moment like this:
<?php
[...] //some DB stuff
<script>js/form.js</script>
<form name="groups" action="" method="post">
<?php foreach($groups as $key): ?>
<div class="field_wrapper">
<div>
<h2><?php echo($key)?></h2>
<input type="text" name="field_rank[]" placeholder="Rank" value=""/>
<input type="text" name="field_name[]" placeholder="Name" value=""/>
<a href="javascript:void(0);" class="add_button" title="Add Row">+</a>
</div>
</div>
<?php endforeach; ?>
<input type="submit" name="submit" value="Submit"/>
</form>
?>
Sadly, it clones everything, not only within the selected group. But the remove button works exactly as intended. Did I miss something?
Also, can I do this without PHP and HTML mixed?
Any ideas, how i can improve this?
Edit: http://techtreedev.de/muster.php this it what it's looks like at the moment (But with German words)
PS: Before downvoting, please consider writing what's wrong with my question. Thanks in advance