Probleme avec les bouton radio

Répondre


Cette question est un moyen d’empêcher des soumissions automatisées de formulaires par des robots.
Smileys
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: =D> #-o =P~ :^o :non: :priere: 8-|
Voir plus de smileys
  Revue du sujet
 

  Étendre la vue Revue du sujet : Probleme avec les bouton radio

par rakizm » 05 févr. 2007, 19:30

salut tt le monde,
vous pensez pas qu'il devrait donner des value différents pour différencier entre les radios du meme id ou du meme name????

par HUE Christophe » 31 janv. 2007, 22:23

Tu aussi voir le contenu de $_POST
print_r($_POST);

par Ajoloca » 25 janv. 2007, 01:03

Bonsoir,

Si j'interprète le message, tu tentes de convertir un tableau en chaine de caractère à la ligne 5.

Es-tu sur que $theValue, soit une chaine de caractères ???
Pour t'en assurer fais un
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{ 
var_dump($theValue);
exit();
.....
Et regarde ce qu'il t'affiche.

je comprends pas trop

par atou » 25 janv. 2007, 00:48

la ligne 5 dois etre ca ($theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; ) je pense

par jojolapine » 24 janv. 2007, 19:46

à quoi correspond la ligne 5 de ton fichier... ?

Probleme avec les bouton radio

par atou » 24 janv. 2007, 19:38

Salut tout monde.voilà j'ai crée un formulaire avec de l'assistant formulaire d'insertion d'enregistrement mais ça cloche quelque part et je ne sais quoi. Pourriez vous m'aider svp. Merci d'avance

voici le formulaire

Code : Tout sélectionner

<form method="post" name="form1" action="<?php echo $editFormAction; ?>"> <table align="center"> <tr valign="baseline"> <td align="right" valign="middle" nowrap>Civilite:</td> <td valign="baseline"><table> <tr> <td><input name="civilite" type="radio" value="civilite" checked="checked" > Mr</td> </tr> <tr> <td><input type="radio" name="civilite" > Mme</td> </tr> <tr> <td><input type="radio" name="civilite" value="" > Mlle</td> </tr> </table></td> </tr> <tr valign="baseline"> <td nowrap align="right">Nom:</td> <td><input type="text" name="nom" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Prenom:</td> <td><input type="text" name="prenom" value="" size="32"></td> </tr> <tr valign="baseline"> <td align="right" valign="middle" nowrap>Denomination:</td> <td valign="baseline"><table> <tr> <td><input name="denomination" type="radio" value="denomination" checked="checked" > Particulier</td> </tr> <tr> <td><input type="radio" name="denomination" value="" > Association</td> </tr> <tr> <td><input type="radio" name="denomination" value="" > Société</td> </tr> </table></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Tel:</td> <td><input type="text" name="tel" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Fax:</td> <td><input type="text" name="fax" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Adresse:</td> <td><input type="text" name="adresse" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Ville:</td> <td><input type="text" name="ville" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Cp:</td> <td><input type="text" name="cp" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Activite:</td> <td><input type="text" name="activite" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Projet:</td> <td><input type="text" name="projet" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Public:</td> <td><input type="text" name="public" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Objectif:</td> <td><textarea name="objectif" cols="50" rows="5"></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right" valign="top">Elementcomplementaires:</td> <td><textarea name="elementcomplementaires" cols="50" rows="5"></textarea> </td> </tr> <tr valign="baseline"> <td nowrap align="right">Datedemisesenlignesouhaitees:</td> <td><input type="text" name="datedemisesenlignesouhaitees" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">&nbsp;</td> <td><input type="submit" value="Insérer l'enregistrement"></td> </tr> </table> <input type="hidden" name="id" value=""> <input type="hidden" name="MM_insert" value="form1"> </form>

la requete dinsertion

Code : Tout sélectionner

<?php require_once('Connections/graphik.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']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO tbl_devis (id, civilite, nom, prenom, denomination, email, tel, fax, adresse, ville, cp, activite, projet, `public`, objectif, elementcomplementaires, datedemisesenlignesouhaitees) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['id'], "int"), GetSQLValueString($_POST['civilite'], "text"), GetSQLValueString($_POST['nom'], "text"), GetSQLValueString($_POST['prenom'], "text"), GetSQLValueString($_POST['denomination'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['tel'], "double"), GetSQLValueString($_POST['fax'], "double"), GetSQLValueString($_POST['adresse'], "text"), GetSQLValueString($_POST['ville'], "text"), GetSQLValueString($_POST['cp'], "int"), GetSQLValueString($_POST['activite'], "text"), GetSQLValueString($_POST['projet'], "text"), GetSQLValueString($_POST['public'], "text"), GetSQLValueString($_POST['objectif'], "text"), GetSQLValueString($_POST['elementcomplementaires'], "text"), GetSQLValueString($_POST['datedemisesenlignesouhaitees'], "date")); mysql_select_db($database_graphik, $graphik); $Result1 = mysql_query($insertSQL, $graphik) or die(mysql_error()); $insertGoTo = "devis.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_graphik, $graphik); $query_insert_devis = "SELECT * FROM tbl_devis"; $insert_devis = mysql_query($query_insert_devis, $graphik) or die(mysql_error()); $row_insert_devis = mysql_fetch_assoc($insert_devis); $totalRows_insert_devis = mysql_num_rows($insert_devis); ?>
Mais à chaque fois j'obtiens ce message d'erreur :

Code : Tout sélectionner

Notice: Array to string conversion in c:\program files\easyphp1-8\www\graph\devis.php on line 5 Notice: Array to string conversion in c:\program files\easyphp1-8\www\graph\devis.php on line 5 Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\graph\devis.php:5) in c:\program files\easyphp1-8\www\graph\devis.php on line 61 Notice: Array to string conversion in c:\program files\easyphp1-8\www\graph\devis.php on line 5 Notice: Array to string conversion in c:\program files\easyphp1-8\www\graph\devis.php on line 5 Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\graph\devis.php:5) in c:\program files\easyphp1-8\www\graph\devis.php on line 92
votre aide me sera trés utile