Bonjour j'ai une application phonegap (jquery mobile) pour l'appel des requête php j'utilise ajax
alors j'ai une page html + ajax + php
j'aimerai rediriger l'utilisateur a la page login après son inscription
Voici mon code html :
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67 <div data-role="page" id="register"> <div data-role="content"> <form id="myForm" action="Connections/inscription.php" method="POST" name="myForm"> <a href="#home"> <img src="img/arrow-back3.png"></a> <div data-role="content"> <table width="500" border="0" align="center"> <tr><td> <a href="#forgot_login"> <img src="img/arrow-back3.png"></a></td> <td align="center"><b>S'INSCRIRE</b></td> </tr> </table> <table width="310" border="0" align="center" style="margin-top:150px"> <tr><tr><td> <label for="nom">Nom</label></td><td></td></tr> <tr><td> <input type="text" name="f_name" id="f_name" placeholder="PRÉNOM" style="color:#000" required/></td> <td align="right"><span id="erreur1"></span></td></tr> <tr><td> <input type="text" name="l_name" id="l_name" placeholder="NOM" style="color:#000" required/> </td><td><span id="erreur2"></span> <span id="ok2"></span></td></tr> <tr><td> MOT DE PASSE </td><td></td></tr> <tr><td> <input type="password" name="password_insc" id="password_insc" placeholder="6-20 CHARACTERES" style="color:#000" required /> </td> <td align="center"><span class="error"></span> <span class="bar"></span></td> </tr> <tr><td> <input type="password" name="re_password" id="re_password" placeholder="REPETER" style="color:#000" required/> </td><td></td></tr> <tr><td> ADRESSE EMAIL </td><td></td></tr> <tr><td> <input type="email" name="email" id="email" placeholder="SOMEONE@EXAMPLE.COM" style="color:#000" required/> </td><td></td></tr> <tr><td align="right"> <input border="0" src="img/connexion.png" type="image" value="register" id="submitinsc"> </td><td></td></tr></tr> </table> </form> </div> </div>
code ajax :
Code php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 $("$submitinsc").click( function() { if ( $ ("#f_name").val() =="" || $ ("#l_name").val() =="" || $ ("#password_insc").val() =="" || $ ("#re_password").val() =="" || $ ("#email").val() =="" ) $("#result").html("veuillez remplir tous les champs"); else $.post( $("myForm").attr("action"), $("#myForm :input").serializeArray(), function(info){ $("#result").empty(); $("#result").html(info); $clear(); } ); clear(); }); $("myform").submit( function() { return false; }); function clear(){ $("myForm :input").each(function() { $(this).val(''); }); };
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <?php include_once('hangingdb.php'); $f_name = mysql_real_escape_string($_POST["f_name"] ); $l_name = mysql_real_escape_string($_POST["l_name"] ); $password_insc = mysql_real_escape_string($_POST["password_insc"] ); $email = mysql_real_escape_string($_POST["email"] ); mysql_query ("INSERT INTO userstest VALUES('$f_name', '$l_name', '$password_insc', '', '$email')"); header('location:index.html'); ?>
j'attends votre repense merci d'avance
Partager