This is a difficult question to explain so bear with me...
I need to output a form wizard based on the following array:
Array
(
[about_you] => Array
(
[qb-name] => about_you
[qb-label] => About You
[qb-type] => ttl
)
[your_name] => Array
(
[qb-name] => your_name
[qb-label] => What is your name?
[required] => required
[qb-type] => slt
)
[website] => Array
(
[qb-name] => website
[qb-label] => What is your current website?
[required] =>
[qb-type] => slt
)
[your_requirements] => Array
(
[qb-name] => your_requirements
[qb-label] => Your Requirements
[qb-type] => ttl
)
[hosting] => Array
(
[qb-name] => age
[qb-label] => How old are you?
[sq-option] => Array
(
[0] => 0-20
[1] => 21-40
[2] => 40+
)
[qb-type] => sel
)
[likes] => Array
(
[qb-name] => likes
[qb-label] => What do you like?
[required] => required
[qb-type] => mlt
)
)
The qb-type => ttl field is a title field and also a new page in the form wizard the output would be as follows for each title:
<div id="wizard">
<!-- foreach.... -->
<h1> [qb-label] </h1>
<div class="content"></div>
<!-- /foreach -->
</div>
so the output from the above array would be...
<div id="wizard">
<h1>About You</h1>
<div class="content"></div>
<h1>Your Requirements</h1>
<div class="content"></div>
</div>
My question is how can I display anything below the title field in the .content area for example:
<div id="wizard">
<h1>About You</h1>
<div class="content">
<p>
<label>What is your name?</label>
<input name="your_name" />
</p>
<p>
<label>What is your current website?</label>
<input name="your_name" />
</p>
</div>
<h1>Your Requirements</h1>
<div class="content">
How old are you?
What do you like?
</div>
</div>
I've managed to out put the title but I'm not sure how I can add the sub fields to each section:
<div id="wizard">
<?php foreach($form as $field=>$option): ?>
<?php if($option['qb-type'] == 'ttl'): ?>
<h1><?= $option['qb-label'] ?></h1>
<div>The content goes here</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
I hope I've managed to explain everything well enough, but please feel free to ask if you need a better explanation.
EDIT Any data directly below the title until you reach the next title would be considered part of the ttl section