probleme formulaire inscription membre

jim0205
Invité n'ayant pas de compte PHPfrance

12 mai 2010, 13:42

bonjour a tous, je tente de creer un formulaie d inscription au site via cdreamweaver cs5

vcoila ou j en suis mais j ai un soucis:

quand je valide le formulaire voila l erreur:

Code : Tout sélectionner

Warning: sprintf() [function.sprintf]: Too few arguments in C:\wamp\www\membres\inscription.php on line 54 Query was empty
et voici le code de la page

<?php 
require("connections/localhost.php");
 ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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 membres (membre_id, membre_pseudo, membre_mdp, membre_mail, membre_inscription, membre_naissance, membre_msn, membre_yahoo, membre_aim, membre_localisation, membre_profession, membre_avatar, membre_biographie, membre_signature) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,)",
                       
                       GetSQLValueString($_POST['membre_pseudo'], "text"),
                       GetSQLValueString($_POST['membre_mdp'], "text"),
                       GetSQLValueString($_POST['membre_mail'], "text"),
                       GetSQLValueString($_POST['membre_naissance'], "text"),
                       GetSQLValueString($_POST['membre_msn'], "text"),
                       GetSQLValueString($_POST['membre_yahoo'], "text"),
                       GetSQLValueString($_POST['membre_aim'], "text"),
                       GetSQLValueString($_POST['membre_localisation'], "text"),
                       GetSQLValueString($_POST['membre_profession'], "text"),
                       GetSQLValueString($_POST['membre_biographie'], "text"),
                       GetSQLValueString($_POST['membre_signature'], "text"));
                       

  mysql_select_db($database_localhost, $localhost);
  $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());

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


<form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
  <table align="center">
       <tr valign="baseline">
      <td nowrap="nowrap" align="right">pseudo:</td>
      <td><input type="text" name="membre_pseudo" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">password:</td>
      <td><input type="password" name="membre_mdp" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">E-mail:</td>
      <td><input type="text" name="membre_mail" value="" size="32" /></td>
    </tr>
       <tr valign="baseline">
      <td nowrap="nowrap" align="right">date de naissance:</td>
      <td><input type="text" name="membre_naissance" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">msn:</td>
      <td><input type="text" name="membre_msn" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">yahoo:</td>
      <td><input type="text" name="membre_yahoo" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">aim:</td>
      <td><input type="text" name="membre_aim" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">localisation:</td>
      <td><input type="text" name="membre_localisation" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">profession:</td>
      <td><input type="text" name="membre_profession" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">biographie:</td>
      <td><input type="text" name="membre_biographie" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">signature:</td>
      <td><input type="text" name="membre_signature" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Insérer un enregistrement" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>



ViPHP
ViPHP | 5462 Messages

12 mai 2010, 13:46

normale, il attend 14 argument tu lui en donne que 11 (et en plus ta requete n'est pas bonne ta une virgule en trop)
d'ailleur je te conseil d'aller voir du coté de vsprintf

Mammouth du PHP | 661 Messages

12 mai 2010, 13:53

dreamWeaver ^^ ... pourkoi se payer dreamCS5, sortie depuis 1 semaine quand on ne sais pas s'en servir et surtout quand il fait ce genre de codes .. :s ... ?

donc sinon, quelle est la ligne 54 ?

de ce que je vois, fait un echo " debug : $insertGoTo <br/>" ; histoire de voir ce que ça donne ! :)

jim0205
Invité n'ayant pas de compte PHPfrance

12 mai 2010, 13:57

c est bon j ai recommencé et sa marche

ps: pourkoi s acheter la nouvelle opel astra quand elle est sortie depuis une semaine et que l on a jamais rouler avec????


ta question na pas de sens .....

Mammouth du PHP | 661 Messages

12 mai 2010, 18:07

ma question est peu-etre brusque, à la relire, je le constate ... cela dit DW n'a jamais été un bon logiciel pour coder !... je me demande donc pourquoi et comment ils font pour le vendre ! ...

ViPHP
AB
ViPHP | 5818 Messages

12 mai 2010, 19:02

ma question est peu-etre brusque, à la relire, je le constate ... cela dit DW n'a jamais été un bon logiciel pour coder !... je me demande donc pourquoi et comment ils font pour le vendre ! ...
Ben ils disent qu'on peut faire du code sans rien comprendre... évidemment ils ne disent pas que les possibilités sont alors très très limitées, et les modifications/évolutions du code quasi nulles :x

@jim0205
Si tu veux un tuto commenté c'est ici. Beaucoup mieux pour apprendre à comprendre...

jim0205
Invité n'ayant pas de compte PHPfrance

12 mai 2010, 19:19

pour répondre a ta question je ne l ai pas acheter ==> version d'évaluation

je ne me voit pas mettre un prix inadmisible pour un éditeur html "php" qui développe un code ou les 3/4 ne sont même pas compréhensible pour moi ^^ :mrgreen: :mrgreen: