Améliorations au niveau de l'inscription

This commit is contained in:
galaxyoyo 2019-08-28 00:28:07 +02:00
parent 8b90877088
commit c3de4a9914
2 changed files with 34 additions and 28 deletions

View File

@ -56,17 +56,20 @@ if (isset($error_message) && $error_message === FALSE) {
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table>
<table style="width: 100%;">
<tr>
<td><label for="email">E-mail :</label></td>
<td><input type="email" id="email" name="email" value="<?php if (isset($email)) echo $email ?>" /></td>
<td style="width: 30%;"><label for="email">E-mail :</label></td>
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email" value="<?php if (isset($email)) echo $email ?>" /></td>
</tr>
<tr>
<td><label for="password">Mot de passe :</label></td>
<td><input type="password" id="password" name="password" /></td>
<td><input style="width: 100%;" type="password" id="password" name="password" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
<td colspan="2"><a href="<?= $URL_BASE ?>/connexion/mdp_oublie">Mot de passe oublié ?</a></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%;" type="submit" value="Se connecter" /></td>
</tr>
</table>
</form>

View File

@ -8,6 +8,7 @@ if (isset($_POST["submitted"])) {
function register() {
global $DB, $YEAR, $URL_BASE, $MAIL_ADDRESS;
global $email, $firstname, $surname, $birth_date, $gender, $address, $postal_code, $city, $country, $phone_number, $role, $school, $class, $responsible_name, $responsible_phone, $responsible_email;
$email = strtolower(htmlspecialchars($_POST["email"]));
@ -145,70 +146,70 @@ function register() {
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 90%;">
<table style="width: 100%;">
<tr>
<td><label for="email">E-mail :</label></td>
<td><input type="email" id="email" name="email" value="<?php if (isset($email)) echo $email ?>" /></td>
<td style="width: 30%;"><label for="email">E-mail :</label></td>
<td style="width: 70%;"><input style="width: 100%;" type="email" id="email" name="email" value="<?php if (isset($_POST["email"])) echo $_POST["email"] ?>" required /></td>
</tr>
<tr>
<td><label for="password">Mot de passe :</label></td>
<td><input type="password" id="password" name="password" /></td>
<td><input style="width: 100%;" type="password" id="password" name="password" required /></td>
</tr>
<tr>
<td><label for="confirm_password">Confirmer le mot de passe :</label></td>
<td><input type="password" id="confirm_password" name="confirm_password" /></td>
<td><input style="width: 100%;" type="password" id="confirm_password" name="confirm_password" required /></td>
</tr>
<tr>
<td><label for="surname">Nom :</label></td>
<td><input type="text" id="surname" name="surname" value="<?php if (isset($surname)) echo $surname ?>" /></td>
<td><input style="width: 100%;" type="text" id="surname" name="surname" value="<?php if (isset($_POST["surname"])) echo $_POST["surname"] ?>" required /></td>
</tr>
<tr>
<td><label for="firstname">Prénom :</label></td>
<td><input type="text" id="firstname" name="firstname" value="<?php if (isset($firstname)) echo $firstname ?>" /></td>
<td><input style="width: 100%;" type="text" id="firstname" name="firstname" value="<?php if (isset($_POST["firstname"])) echo $_POST["firstname"] ?>" required /></td>
</tr>
<tr>
<td><label for="birth_date">Date de naissance :</label></td>
<td><input type="date" id="birth_date" name="birth_date" value="<?php if (isset($birth_date)) echo $_POST["birth-date"] ?>" /></td>
<td><input style="width: 100%;" type="date" id="birth_date" name="birth_date" value="<?php if (isset($_POST["birth_date"])) echo $_POST["birth-date"] ?>" required /></td>
</tr>
<tr>
<td><label for="gender">Sexe :</label></td>
<td><input type="radio" id="male" name="gender" value="M" /><label for="male">Homme</label>
<input type="radio" id="female" name="gender" value="F" /><label for="female">Femme</label></td>
<td><input type="radio" id="male" name="gender" value="M" required <?= isset($_POST["gender"]) && $_POST["gender"] == "M" ? "checked" : "" ?> /><label for="male">Homme</label>
<input type="radio" id="female" name="gender" value="F" required <?= isset($_POST["gender"]) && $_POST["gender"] == "F" ? "checked" : "" ?> /><label for="female">Femme</label></td>
</tr>
<tr>
<td><label for="address">Adresse :</label></td>
<td><input type="text" id="address" name="address" value="<?php if (isset($address)) echo $address ?>" /></td>
<td><input style="width: 100%;" type="text" id="address" name="address" value="<?php if (isset($_POST["address"])) echo $_POST["address"] ?>" /></td>
</tr>
<tr>
<td><label for="postal_code">Code postal :</label></td>
<td><input type="number" id="postal_code" name="postal_code" value="<?php if (isset($postal_code)) echo $postal_code ?>" min="1000" max="95999" /></td>
<td><input style="width: 100%;" type="number" id="postal_code" name="postal_code" value="<?php if (isset($_POST["postal_code"])) echo $_POST["postal_code"] ?>" min="1000" max="95999" required /></td>
</tr>
<tr>
<td><label for="city">Ville :</label></td>
<td><input type="text" id="city" name="city" value="<?php if (isset($city)) echo $city ?>" /></td>
<td><input style="width: 100%;" type="text" id="city" name="city" value="<?php if (isset($_POST["city"])) echo $_POST["city"] ?>" /></td>
</tr>
<tr>
<td><label for="country">Pays :</label></td>
<td><input type="text" id="country" name="country" value="<?php echo isset($country) ? $country : "France" ?>" /></td>
<td><input style="width: 100%;" type="text" id="country" name="country" value="<?php echo isset($_POST["country"]) ? $_POST["country"] : "France" ?>" required /></td>
</tr>
<tr>
<td><label for="phone_number">Numéro de téléphone :</label></td>
<td><input type="text" id="phone_number" name="phone_number" value="<?php if (isset($phone_number)) echo $phone_number ?>" /></td>
<td><input style="width: 100%;" type="text" id="phone_number" name="phone_number" value="<?php if (isset($_POST["phone_number"])) echo $_POST["phone_number"] ?>" /></td>
</tr>
<tr>
<td><label for="role">Rôle :</label></td>
<td><select id="role" name="role" onchange="selectRole()">
<td><select style="width: 100%;" id="role" name="role" onchange="selectRole()">
<option value="participant">Participant</option>
<option value="encadrant">Encadrant</option>
</select></td>
</tr>
<tr>
<td><label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label></td>
<td><input type="text" id="school" name="school" value="<?php if (isset($school)) echo $school ?>" /></td>
<td><input style="width: 100%;" type="text" id="school" name="school" value="<?php if (isset($_POST["school"])) echo $_POST["school"] ?>" /></td>
</tr>
<tr>
<td><label id="class_label" for="class">Classe :</label></td>
<td><select id="class" name="class">
<td><select style="width: 100%;" id="class" name="class">
<option value="terminale">Terminale</option>
<option value="premiere">Première</option>
<option value="seconde">Seconde ou inférieur</option>
@ -216,22 +217,22 @@ function register() {
</tr>
<tr>
<td><label id="responsible_name_label" for="responsible_name">Nom du responsable légal :</label></td>
<td><input type="text" id="responsible_name" name="responsible_name" value="<?php if (isset($responsible_name)) echo $responsible_name ?>" /></td>
<td><input style="width: 100%;" type="text" id="responsible_name" name="responsible_name" value="<?php if (isset($_POST["responsible_name"])) echo $_POST["responsible_name"] ?>" /></td>
</tr>
<tr>
<td><label id="responsible_phone_label" for="responsible_phone">Téléphone du responsable légal :</label></td>
<td><input type="text" id="responsible_phone" name="responsible_phone" value="<?php if (isset($responsible_phone)) echo $responsible_phone ?>" /></td>
<td><input style="width: 100%;" type="text" id="responsible_phone" name="responsible_phone" value="<?php if (isset($_POST["responsible_phone"])) echo $_POST["responsible_phone"] ?>" /></td>
</tr>
<tr>
<td><label id="responsible_email_label" for="responsible_email">Email du responsable légal :</label></td>
<td><input type="text" id="responsible_email" name="responsible_email" value="<?php if (isset($responsible_email)) echo $responsible_email ?>" /></td>
<td><input style="width: 100%;" type="text" id="responsible_email" name="responsible_email" value="<?php if (isset($_POST["responsible_email"])) echo $_POST["responsible_email"] ?>" /></td>
</tr>
<tr>
<td><label id="description_label" for="description">Description :</label></td>
<td><textarea id="description" name="description"><?php if (isset($description)) echo $description ?></textarea></td>
<td><textarea style="width: 100%;" id="description" name="description"><?php if (isset($_POST["description"])) echo $_POST["description"] ?></textarea></td>
</tr>
<tr>
<td colspan="2"><input type="submit" /></td>
<td colspan="2"><input style="width: 100%;" type="submit" value="S'inscrire" /></td>
</tr>
</table>
</form>
@ -242,6 +243,7 @@ function register() {
case "participant":
document.getElementById("school_label").style.display = "block";
document.getElementById("school").style.display = "block";
document.getElementById("school").require = "true";
document.getElementById("class_label").style.display = "block";
document.getElementById("class").style.display = "block";
document.getElementById("responsible_name_label").style.display = "block";
@ -256,6 +258,7 @@ function register() {
case "encadrant":
document.getElementById("school_label").style.display = "none";
document.getElementById("school").style.display = "none";
document.getElementById("school").require = "false";
document.getElementById("class_label").style.display = "none";
document.getElementById("class").style.display = "none";
document.getElementById("responsible_name_label").style.display = "none";