bonjour
je coince sur une coince a priori simple
j'ai mon formulaired'inscription avec champs null et notnull sur la bdd (tous ne sont pas obligatoires)
j'ai fait plusieurs tentatives, (je vous fais grâce de tous les codes tentés)
j'ai soit syntaxe error (m'enfin, c'est presque "normal"), ou alors le message apparait avant le remplissage des champs, ou alors mysql m'ouvre une page blanche en anglais "column must be filled"
je cherche deux options :
-soit je fais une requete pour que mysql ouvre ma page " inscription erronée" avec le texte qui va bien
-soit je mets les conditions bien comme ilfaut pour avoir les echo au bon endroit pour les champs non remplis; je suis perdu
je n'arrive à rien faire de tout ça et ça commence à me....légèrement
voilà une partie de mon code :
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
 
<?php require_once('../Connections/mb.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"] == "membre")) {
  $insertSQL = sprintf("INSERT INTO membre (prenom1, prenom2, nom1, nom2, email, pseudo, password, sexe, jour, mois, annee, rue, numrue, ville, cp, province, pays, telephone) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['prenom1mem'], "text"),
                       GetSQLValueString($_POST['prenom2mem'], "text"),
                       GetSQLValueString($_POST['nom1mem'], "text"),
                       GetSQLValueString($_POST['nom2mem'], "text"),
                       GetSQLValueString($_POST['mailmembre'], "text"),
                       GetSQLValueString($_POST['pseudo'], "text"),
                       GetSQLValueString($_POST['mot_de_passe'], "text"),
                       GetSQLValueString($_POST['sexe'], "text"),
                       GetSQLValueString($_POST['jourmem'], "int"),
                       GetSQLValueString($_POST['moismem'], "text"),
                       GetSQLValueString($_POST['anneemem'], "int"),
                       GetSQLValueString($_POST['rue'], "text"),
                       GetSQLValueString($_POST['numrue'], "int"),
                       GetSQLValueString($_POST['ville'], "text"),
                       GetSQLValueString($_POST['cp'], "int"),
                       GetSQLValueString($_POST['province'], "text"),
                       GetSQLValueString($_POST['pays'], "text"),
                       GetSQLValueString($_POST['telephone'], "int"));
 
  mysql_select_db($database_mb, $mb);
  $Result1 = mysql_query($insertSQL, $mb) or die(mysql_error());
 
<form action="<?php echo $editFormAction; ?>" id="membre" name="membre" method="POST">
 
<input name="prenom1mem" type="text" id="prenom1mem"  />
                <label for="prenom1mem"></label>
                <span class="Style80">2°prénom </span>
                <input name="prenom2mem" type="text" id="prenom2mem" />
                <label for="prenom2mem"></label>
merci d'avance, en espérant avoir suffisamment précis