<?php
$contentData = [
    'nickname'=>'',
    'favoriteColor'=>''
]; 
if($section){
    $contentData = json_decode($section->content_data, true);
}
?>
<div id="section_form">

    <div class="card">
        <div class="card-header">
            <?php if(!$section):?>
            <div class="alert alert-info">Create section</div>
            <?php else: ?>
            <div class="alert alert-info">Update section</div>
            <?php endif; ?>
        </div>
        <div class="card-body">
            <form method="POST" up-target="#note-container" action="/process_form_submit" up-history="false">
                <?php if($section): ?>
                    <input type="hidden" name="section_uid" value="<?= $section->uid?>">
                <?php else: ?>
                    <input type="hidden" name="note_uid" value="<?= $note->uid?>">
                    <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
                <?php endif; ?>
                <div class="form-group">
                    <label for="">Nickname</label>
                    <input type="text" class="form-control" name="nickname" value="<?= $contentData['nickname'] ?>" placeholder="nickname">
                </div>
                <div class="form-group">
                    <label for="">Favorite color</label>
                    <input type="text" class="form-control" name="favoriteColor" value="<?= $contentData['favoriteColor'] ?>" placeholder="Favorite color">
                </div>
                <div class="form-group">
                    <button class="btn btn-primary">Submit</button>
                </div>
            </form>
        </div>

    </div>
</div>