Php

Bonjour,


Comment lier des champs dans une interface programmer avec le langage PHP avec des champs dans une base de données MySQL??? Sivoupléééééé heeellpp!!

9 réponses

  1. Tu veux envoyer les données d' un formulaire à une base de donnée ?
    0
    1. je veux envoyer des données à une base de donnée et afficher des infos de la méme base de donnée selon le code client
      0
      1. Tu as réussi a faire un formulaire ?
        Si oui peux tu nous montrer le code
        0
        1. <?php require_once('Connections/con1.php'); ?>
          <?php
          if (!function_exists("GetSQLValueString")) {
          function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
          {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

          $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

          switch ($theType) {
          case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
          case "long":
          case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
          case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
          case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
          case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
          }
          return $theValue;
          }
          }

          $editFormAction = $_SERVER['PHP_SELF'];
          if (isset($_SERVER['QUERY_STRING'])) {
          $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
          }

          if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
          $insertSQL = sprintf("INSERT INTO client (CIN, TP, RC, 'IF') VALUES (%s, %s, %s, %s)",
          GetSQLValueString($_POST['cin'], "text"),
          GetSQLValueString($_POST['tp'], "text"),
          GetSQLValueString($_POST['rc'], "text"),
          GetSQLValueString($_POST['if'], "text"));

          mysql_select_db($database_con1, $con1);
          $Result1 = mysql_query($insertSQL, $con1) or die(mysql_error());

          $insertGoTo = "insertioncat.php";
          if (isset($_SERVER['QUERY_STRING'])) {
          $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
          $insertGoTo .= $_SERVER['QUERY_STRING'];
          }
          header("Location: insertioncat.php");
          }
          ?>

          <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
          <table width="200" border="1" align="center">
          <tr>
          <th scope="row">Nom client </th>
          <td><label>
          <input name="nom" type="text" id="nom" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Choisissez un code </th>
          <td><label>
          <input name="code" type="password" id="code" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Adresse</th>
          <td><label>
          <input name="adr" type="text" id="adr" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Téléphone</th>
          <td><label>
          <input name="tel" type="text" id="tel" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">CIN </th>
          <td><label>
          <input name="cin" type="text" id="cin" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Taxe Professionnelle </th>
          <td><label>
          <input name="tp" type="text" id="tp" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Registre de commerce </th>
          <td><label>
          <input name="rc" type="text" id="rc" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Identifiant fiscal </th>
          <td><label>
          <input name="if" type="text" id="if" />
          </label></td>
          </tr>
          <tr>
          <th scope="row">Date création </th>
          <td><label>
          <input name="date" type="text" id="date" />
          </label></td>
          </tr>

          <tr>
          <th scope="row">cliquez sur suivant </th>
          <td><label>
          <input type="submit" name="Submit" value="Suivant" />
          </label></td>
          </tr>
          </table>
          <input type="hidden" name="MM_insert" value="form1">
          </form>
          c la code pour insérer des données dans la bdd
          0
          1. pour l'affichage je doi faire un select ?? c ça ??
            0
            1. Je trouve que ca fait beaucoup de charabia pour pas grand chose, bien entendu rien ne se passe quand tu valides le formulaire?
              0