Bonjour,

Pour commencer, un grand merci pour toutes les solutions concrètes apportée dans ce forum. Je m'excuse d'avance de ne pas avoir trouvé la réponse existant probablement dans un autre post

Après conditionnement de l'insertion MM_insert codée par Dreamwaver (ç'est ma methode d'apprentissage), je me retrouve avec une erreur sur le header qui permettais la re-direction en cas de succès. Je maitrise pas encore très bien header() et j'ai du mal a comprendre comment/pourquoi Dreamw. y implante un sprintf() encore plus occulte pour moi ^^

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
<?php //codé par Dreamweaver
 require_once('../Connections/DBConNewProfile.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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']);
}
?>
<?php //conditionnement par mes soins...d'autre sont prévues
if ((isset($_POST["mail"])) && ($_POST["mail"] == $_POST["Cmail"])) {
 ?>
 <?php //suite du code DreamW.
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO profiles (password, email, `User`) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['pass'], "text"),
                       GetSQLValueString($_POST['mail'], "text"),
                       GetSQLValueString($_POST['pseudo'], "text"));
 
  mysql_select_db($database_DBConNewProfile, $DBConNewProfile);
  $Result1 = mysql_query($insertSQL, $DBConNewProfile) or die(mysql_error());
 
  $insertGoTo = "../index.html";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo)); //header en erreure L57
}
?>
<?php } //fin de mon conditionnement 
?>
...
<?php echo $editFormAction; //à la déclaration HTML du form1 ?>
...
J'ai économiser HTML j'éspère que vous en aurez pas besoin...

Le message d'erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Warning: Cannot modify header information - headers already sent by (output started at k:\~\html\newp2.php:3) in k:\~\html\newp2.php on line 57
Comme si il voulait actualiser la page au lieu de rediriger... (je suis peu-être aussi à côté de la plaque...^^)
L'insertion Sql, elle, se fait, au regard de "mon conditionnement".
Sans "mon conditionnement",rien a signaler.

Merci d'avance pour vos réponses.