<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<div class="container"><h1>Accordian Builder</h1>
<?php
$items = $_POST['item'];
if(empty($items)): ?>
<div class="wrapper">
<form action="" method="post">
<?php for($i = 1; $i <= 10; $i++){ ?>
<p>TITLE: <input type="text" name="item[<?php echo $i; ?>][title]"></p>
<p>TEXT: <textarea name="item[<?php echo $i; ?>][text]" cols="30" rows="10"></textarea></p>
<hr />
<?php }?>
<p><input type="submit" name="submit"></p>
</form>
</div>
<?php endif; ?>
<div class="wrapper">
<?php
if(!empty($items)):
ob_start();?><div class="panel-group" id="accordion"><?php