<?php include "includes/header.php"; $specs = getSpecs($dbhandle); $states = getStates($dbhandle); include "includes/handle_profile.php"; ?> <div class="starter-template left"> <h3>Profile</h3> <p class="lead">Set up your profile to receive notifications</p> <form action="" method="post"> <?php if ($msg != '') { ?> <p class="alert alert-danger"><?php echo $msg; ?> </p> <?php } ?> <?php if ($msg2 != '') { ?> <p class="alert alert-success"><?php echo $msg2; ?> </p> <?php
foreach ($specs as $spec) { $return .= '<option value="' . $spec['id'] . '">' . $spec['name'] . '</option>'; } $return .= '</optgroup>'; } return $return; } function getCharacters() { $myDB = new DBFactory(); $sql = $myDB->getMysqlConnexionWithPDO(); $query = $sql->prepare("SELECT chars.*, class.name AS className, spec1.role_name AS role1, spec2.role_name AS role2 FROM chars, specs AS spec1, specs AS spec2, class WHERE chars.spec1 = spec1.id AND chars.spec2 = spec2.id AND spec1.class_id = class.id"); $query->execute(); return $query->fetchAll(); } ?> <div> <form action="./include/query.php" method="post"> <input type="hidden" name="action" value="add_raider" /> <p><label>Nom du personnage : <input type="text" name="char_name" /></label></p> <p><label>Spécialisation 1 : <select name="char_spec1"><?php echo getSpecs($sql); ?> </select></label></p> <p><label>Spécialisation 2 : <select name="char_spec2"><?php echo getSpecs($sql); ?> </select></label></p> <p><input type="submit" value="Ajouter" /></p> </form> </div>