IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Inscription formulaire et base de donnée


Sujet :

PHP & Base de données

  1. #1
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mai 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2010
    Messages : 2
    Points : 1
    Points
    1
    Par défaut Inscription formulaire et base de donnée
    Je vous explique mon problème :
    Je dois créer un site marchand . Pour cela, j'aimerais mettre en place une base de donnée via MySQL.
    L'idée est que le client s'inscrit sur le site et que les données soient transférer vers ma table ( ici c'est client)
    J'aimerais aussi que le client puisse se loguer par la suite sur le site.

    Voici la page d'accueil du site qui s'appelle pagedaccueil.html
    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
    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
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
     
    <title>Restaurant - Page d'accueil</title>
    <body background = "anneaux_feu.jpg">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="mm_restaurant1.css" type="text/css" />
    <style type="text/css">
    <!--
    .Style1 {color: #0066FF}
    .Style3 {
    	font-family: cursive;
    	color: #999999;
    }
    .Style4 {
    	color: #330099;
    	font-size: 14px;
    }
    .Style8 {color: #999999}
    .Style9 {
    	color: #0033FF;
    	font-size: 24px;
    }
    .Style11 {
    	color: #330099;
    	font-size: 18px;
    }
    .Style13 {
    	color: #330099;
    	font-size: 18;
    }
    .Style15 {
    	color: #330099;
    	font-size: 24px;
    }
    .Style16 {
    	color: #000000;
    	font-size: 24px;
    }
    .Style24 {
    	color: #FFFFFF;
    	font-size: 24px;
    }
    .Style29 {
    	color: #FF0000;
    	font-size: 24px;
    }
    .Style17 {color: #330099}
    .Style19 {font-size: 14px}
    -->
    </style>
    </head>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    	<background = "anneaux_feu.jpg">
    	<td width="226" nowrap="nowrap" background = "anneaux_feu.jpg" ><img alt="" width="15" height="1" border="0" /></td>
    	<td height="60" colspan="3" nowrap="nowrap" background = "anneaux_feu.jpg" class="logo"><br />
    	  <span class="Style29">PIZZA HOT</span> <span class="tagline Style29"><span class="tagline  Style11"><span class="tagline  Style13"><span class="tagline  Style15"><span class="tagline  Style17">| <span class="Style3">Parceque c'est toujours chaud</span> </span></span></span></span></span></td>
    	<td width="4">&nbsp;</td>
    	<td width="302"background = "anneaux_feu.jpg">&nbsp;</td>
    	</tr>
     
    	<tr background = "anneaux_feu.jpg">
    	<td width="226" nowrap="nowrap" background = "anneaux_feu.jpg">&nbsp;</td>
    	<td height="36" colspan="3" nowrap="nowrap" class="navText" id="navigation"><div align="center"><span class="Style24"><a href="Paged'acceuil.html">Acceuil&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="formule.html">Formule</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="carte.html">Carte</a> &nbsp;&nbsp;&nbsp;<a href="commande.html">Commande</a>&nbsp;</span>&nbsp;&nbsp;</div></td>
    	  <td width="4">&nbsp;</td>
    	<td width="302" background = "anneaux_feu.jpg">&nbsp;</td>
    	</tr>
     
    	<tr background = "anneaux_feu.jpg">
    	<td colspan="2" valign="top" background = "anneaux_feu.jpg"><img src="pizzahot.jpg" alt="Home Page Image" width="227" height="170" border="0" />
    	<table border="0" cellspacing="0" cellpadding="0" width="0">
    		<tr>
    		<td width="10" background = "anneaux_feu.jpg">&nbsp;</td>
    		<td width="205" background = "anneaux_feu.jpg" class="smallText" id="padding"><p>&nbsp;</p>
    		  <p>&nbsp;</p>
    		  <p align="center"><span class="subHeader Style8">Ouvert 7 jours sur 7<br />
    		    De 10h00 &agrave; 14h30<br />
    		    et de 19h00 &agrave; 22h30</span></p>
    		  <p align="left">&nbsp;</p>
    		  <p align="center" class="Style8">Tel : 01 63 10 76 09 </p>
    		  <p><br />
    	        </p>
    		  <br />		</td>
    		<td width="15" bordercolor="#0000FF" bgcolor="#0033FF">&nbsp;</td>
    		</tr>
    	</table>	</td>
    	<td width="50" valign="top"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
    	<td width="440" valign="top"><br />
    	&nbsp;<br />
    	<table width="483" height="461" border="0" cellpadding="0" cellspacing="0">
    		<tr>
    		<td bgcolor="#ff0000" class="pageHeader Style16"><p align="center"> &quot;Bienvenue chez Pizza hot </p>
    		  <p align="center">   votre restaurant en ligne&quot; </p></td>
    		</tr>
     
    		<tr>
    		<td background = "anneaux_feu.jpg" class="bodyText"><p align="center" class="Style8"> Toutes nos pizzas sont chaudes et pr&eacute;par&eacute;s &agrave; la commande,<br />
    		  vos plats seront   accompagn&eacute;s de ketchup,mayonnaise ou sauce piquante</p>
     
    		  <p align="center" class="Style8">Ch&egrave;ques et tickets restaurants accept&eacute;s</p>
    		  <p>&nbsp; </p>
    		  <br />		</td>
    		</tr>
    		<tr>
    		  <td bgcolor="#0033FF" class="bodyText"><div align="center" class="Style8">8 rue de l'obesité Paris 18 ème </div></td>
    	    </tr>
    	</table>	</td>
    	<td width="4">&nbsp;</td>
    	<td width="302"><div align="left"></div></td>
    	</tr>
            <form action="login.php" method='post'>
              <td><span class="Style20">Login :</span></td>
              <td><input type="text" name="login" maxlength="250"></td>
            </tr>
            <tr>
              <td><span class="Style20">Password</span></td>
              <td><input type="password"name="pass" maxlength="10"></td>
            </tr>
            <tr>
              <td colspan="2" align="center"><input name="submit" type="submit" value="log in"></td>
    	</form> 
     
            </tr>
          </table>
    	  <p align="center"><a href="inscription.php" class="Style20">Vous voulez commander ? inscrivez-vous en cliquant ici ;) </a></p>
    	</tr>
     
    	<p align="center"><a href="referencement.php" class="Style20">Pas encore référencer ? cliquer ici pour recevoir la newsletter </a></p>
    	</div></td>
    	</tr>
     
    	<tr bgcolor="#ffffff">
    	<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
    	</tr>
     
    	<tr>
    	<td colspan="6">&nbsp;</td>
    	</tr>
     
     
    	<tr bgcolor="#003399">
    	<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
    	</tr>
     
    	<tr>
    	<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
    	</tr>
     
    	<tr bgcolor="#003399">
    	<td colspan="6"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
    	</tr>
     
     
    	<tr>
    	<td width="226">&nbsp;</td>
    	<td width="4">&nbsp;</td>
    	<td width="50">&nbsp;</td>
    	<td width="440">&nbsp;</td>
    	<td width="4">&nbsp;</td>
    	<td width="302">&nbsp;</td>
    	</tr>
    </table>
    </body>
    </html>
    Inscription.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
    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
     
    <html>
     
     
    <img src="pizzahot.jpg" alt="Home Page Image" width="227" height="170" border="0" />
    	<table border="0" cellspacing="0" cellpadding="0" width="230">
     
    <basefont face ="verdana" size = "4" color = "navy">
    <B>Veuillez remplir les champs pour pouvoir vous inscrire</B>
     
     <form action="traitementinscription.php" method='post'>
     
    <table align="center" border="0">
      <tr>
        <td>Login :</td>
        <td><input type="text" name="login" maxlength="250"></td>
      </tr>
     
      <tr>
        <td>Password</td>
        <td><input type="password" name="pass" maxlength="10"></td>
      </tr>
     
      <tr>
        <td>Telephone</td>
        <td><input type="number" name="telephone" maxlength="10"></td>
      </tr>
     
      <tr>
        <td>Nom</td>
        <td><input type="text" name="nom" maxlength="25"></td>
      </tr>
     
      <tr>
        <td>Prenom</td>
        <td><input type="text" name="prenom" maxlength="25"></td>
      </tr>
     
      <tr>
        <td>Adresse</td>
        <td><input type="text" name="adresse" maxlength="50"></td>
      </tr>
      <tr>
        <td>Email</td>
        <td><input type="text" name="email" maxlength="50"></td>
      </tr>
     
     
     
        <td colspan="2" align="center"><input type="submit" value="S'inscrire"></td>
      </tr>
    </table>
    </form> 
     
    </html>
    traitementinscription.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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
     
    <hmtl>
     
     
    <img src="pizzahot.jpg" alt="Home Page Image" width="227" height="170" border="0" />
    	<table border="0" cellspacing="0" cellpadding="0" width="230">
     
    <?php
     
    $dbhost = "localhost"; 
     
    $usebdd = "inscription";
     
    $user= "root";
     
    $password= "";
     
    $connexion = mysql_connect ("$dbhost","$user","$password");
     
    mysql_select_db($usebdd);
     
     
    if(isset($_POST) && !empty($_POST['login']) && !empty($_POST['pass'])) {
      extract($_POST);
     
      // $sql = "select mdp from client where login='".$login."'";
     
         $sql = "insert into client (login,mdp,telephone,nom,prenom,adresse,email) 
        values ('".$login."' , '".$pass."' , '".$telephone."' , '".$nom."' , '".$prenom."' , '".$adresse."' , '".$email."')";
     
         $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
     
    	echo " Votre compte a bien été créé <a href='pagedaccueil.html'> cliquez ici pour retourner à la page d'acceuil </a> ";
     
    }
     
    ?>php
     
     
    </html>


    Je suis débutant et je ne comprend pas ou est le probleme. J'ai bien entendu creer une bdd inscription et une table client

    Help me

  2. #2
    Nouveau Candidat au Club
    Profil pro
    Inscrit en
    Mai 2010
    Messages
    2
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2010
    Messages : 2
    Points : 1
    Points
    1
    Par défaut Supp
    Je voulais juste preciser que lorsque je clique sur inscription, on m'affiche simplement le codage de traitementinscription

Discussions similaires

  1. [MySQL] Insertion données formulaire dans base de données
    Par westlaux dans le forum PHP & Base de données
    Réponses: 8
    Dernier message: 21/06/2007, 20h17
  2. formulaire / php / base de données
    Par amandine_drooplette dans le forum Langage
    Réponses: 6
    Dernier message: 07/06/2007, 13h14
  3. Formulaire et base de données
    Par Néo{le pélo du 974} dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 04/06/2007, 12h04
  4. Formulaire et base de données
    Par Marye dans le forum IHM
    Réponses: 4
    Dernier message: 08/02/2007, 22h07
  5. [Conception] Formulaire et base de donnée ?
    Par heldev dans le forum PHP & Base de données
    Réponses: 3
    Dernier message: 10/03/2006, 17h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo