Commit 9e5ac5ed authored by Liang Wu's avatar Liang Wu

profil

parent 09363e2c
......@@ -76,7 +76,6 @@
<th>Type</th>
<th>Modifier</th>
<th>Supprimer</th>
<th>Ajouter au Journal </th>
</tr>
</thead>
<tbody id="tbody_aliment"><tbody>
......
......@@ -11,13 +11,13 @@
</script>
<script type="text/javascript">
$(document).ready( function() {
var ident= sessionStorage.getItem('para');
var ident = sessionStorage.getItem('para');
// var essai= "lwu";
$.getJSON('https://eden.imt-lille-douai.fr/~liang.wu/API_LOGIN/identite/read_one.php?login='+ident,
function(data){
table = $('#tbody_info');
table.html('');
table.append('<tr><td>'+data.id+'</td><td>'+data.login+'</td><td>'+data.password+'</td><td>'+data.pseudo+'</td><td>'+data.age+'</td><td>'+data.poids+'</td><td>'+data.taille+'</td><td>'+data.sexe+'</td><td>'+data.niveaudusport+'</td></tr>');
table.append('<tr><td>'+data.id+'</td><td>'+data.login+'</td><td>'+data.password+'</td><td>'+data.pseudo+'</td><td>'+data.age+'</td><td>'+data.poids+'</td><td>'+data.taille+'</td><td>'+data.sexe+'</td><td>'+data.niveaudusport+'</td><td>'+data.icalories+'</td></tr>');
});
});
......@@ -27,11 +27,11 @@
<section id="profil_contenu" style="display : flex; flex-direction : row; ">
<div style="margin-right:100px">
<h1>informations Personnelles</h1>
<table id="table_info" class="dataTable" style="color : #212529; ">
<thead>
<tr>
<th>id</th>
<th>ID</th>
<th>login</th>
<th>password</th>
<th>pseudo</th>
......@@ -40,10 +40,105 @@
<th>taille(cm)</th>
<th>sexe</th>
<th>niveau_du_sport</th>
<th>Action</th>
<th>Besoin en calories journalier(Kcal)</th>
</tr>
</thead>
<tbody id="tbody_info"><tbody>
</table>
</div>
</section>
\ No newline at end of file
</section>
<section>
<h1>Utilisez ce formulaire, si vous voulez modifier vos informations</h1>
<form id="form_edit" action="#" method="POST" >
<div>
<label>ID (Remettez votre ID)</label>
<input type='text' id='id' name='id' class="form-control" required />
</div>
<div>
<label>Login</label>
<input type='text' id='login' name='login' class="form-control" required />
</div>
<div>
<label>Password</label>
<input type='text' id='password' name='password' class="form-control" required />
</div>
<div>
<label>Pseudo</label>
<input type='text' id='pseudo' name='pseudo' class="form-control" required/>
</div>
<div>
<label>Âge</label>
<input type='text' id='age' name='age' class="form-control" required />
</div>
<div>
<label>Poids(kg)</label>
<input type='text' id='poids' name='poids' class="form-control" required/>
</div>
<div>
<label>Taille(cm)</label>
<input type='text' id='taille' name='taille' class="form-control" required/>
</div>
<div class="form-group">
<label>Sexe</label>
<select class="form-control" id="sexe" name="sexe">
<option selected>Choisir...</option>
<option>Femme</option>
<option>Homme</option>
</select>
</div>
<div class="form-group">
<label>Niveau de sport</label>
<select class="form-control" id="niveaudusport" name="niveaudusport">
<option selected>Choisir...</option>
<option>Bas</option>
<option>Moyen</option>
<option>Elevé</option>
</select>
</div>
<!-- button to submit form -->
</div>
<div class="form-action-buttons">
<input type="submit" value="Modifier">
</div>
</form>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-serialize-object/2.5.0/jquery.serialize-object.min.js" ></script>
<script type="text/javascript">
$(document).ready( function($) {
// will run if create identite form was submitted
$(document).on('submit', '#form_edit', function(){
// get form data
var form_data=JSON.stringify($(this).serializeObject());
// console.log(form_data);
// submit form data to api
$.ajax({
url: "https://eden.imt-lille-douai.fr/~liang.wu/API_LOGIN/identite/update.php",
type : "POST",
contentType : 'application/json',
data : form_data
});
});
});
</script>
</section>
<head>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#table_récap').DataTable();
} );
</script>
</head>
<section>
<table>
<tr>
<td>
<table id="table_récap" class="dataTable" style="color : #212529; ">
<thead>
<tr>
<th>Login</th>
<th>Âge</th>
<th>Poids</th>
<th>Taille(m)</th>
<th>Sexe</th>
<th>Niveau de sport</th>
<th>Besoins journaliers en calories</th>
<th>CRUD</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</td>
<td>
<form onsubmit="event.preventDefault();onFormSubmit();" autocomplete="off">
<table>
<tr>
<th>Login :</th>
<td><input type="text" name="login" id="login"></td>
</tr>
<tr>
<th>Âge :</th>
<td>
<input type="text" name="age" id="age">
</td>
</tr>
<tr>
<th>Poids(kg) :</th>
<td>
<input type="text" name="poids" id="poids">
</td>
</tr>
<tr>
<th>Taille(m):</th>
<td>
<input type="text" name="taille" id="taille">
</td>
</tr>
<tr>
<th>Sexe :</th>
<td>
<label> Homme
<input type="radio" name="sex" id="M">
</label><br>
<label> Femme
<input type="radio" name="sex" id="F">
</label></td>
</tr>
<tr>
<th>Niveau de pratique sportive :</th>
<td>
<label> Bas
<input type="radio" name="sport" id="bas">
</label><br>
<label> Moyen
<input type="radio" name="sport" id="moyen">
</label><br>
<label> Elevé
<input type="radio" name="sport" id="eleve">
</label>
</td>
</tr>
<tr>
<td><input type="submit" name="Valider"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<script src="scriptcalcul.js"></script>
<h2> Nom </h2>
<img src="logo.png" alt="" height="90px" width="150px"/>
</section>
</body>
</html>
\ No newline at end of file
......@@ -3,13 +3,13 @@ require_once('template_header.php');
?>
<section>
<div id="response"></div>
<div><a href="index.php">Se connecter</a></div>
</section>
<section>
<!-- 'create identite' html form -->
<form id="form_signup" action="#" method="POST" >
<form id="form_signup" method="POST" >
<div>
<label>Login</label>
<input type='text' id='login' name='login' class="form-control" required />
......@@ -89,19 +89,7 @@ $(document).ready( function($) {
url: "https://eden.imt-lille-douai.fr/~liang.wu/API_LOGIN/identite/create.php",
type : "POST",
contentType : 'application/json',
data : form_data,
success : function(result){
$('#response').html("<div class='alert alert-danger'>success.</div>");
},
error: function(xhr, resp, text){
// on error, tell the user login has failed & empty the input boxes
$('#response').html("<div class='alert alert-danger'>failed</div>");
login_form.find('input').val('');
}
data : form_data
});
});
});
......
......@@ -5,7 +5,6 @@ $mymenu = array(
// idPage titre
'home' => array( 'Accueil' ),
'profil_affichage' => array( 'Profil' ),
'profil_modif' => array( 'Modifier mon profil' ),
'aliments' => array('Aliments'),
'journal' => array('Journal')
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment