HugoGirard
Messages postés2Date d'inscriptionmercredi 22 août 2007StatutMembreDernière intervention 8 janvier 2008
-
8 janv. 2008 à 22:20
nickadele
Messages postés1251Date d'inscriptionmercredi 7 août 2002StatutModérateurDernière intervention10 avril 2013
-
9 janv. 2008 à 09:07
Bonjour tlm, en espérant que quelqu'un sera capable de répondre à ma question. Je fait un formulaire dans DreamWeaver, j'ai déjà une table MySQL créer chez mon hébergeur. Cependant je suis incapable de m'y connecter. Voici mon code :
<?
$host = "127.0.0.1"; // voir hébergeur
$user = "*****"; // L'usager est bon
$pass = "*****"; // Le mot de passe est bon
$bdd = "****"; // La BD est bonne
@mysql_connect($host,$user,$pass)
or die("Impossible de se connecter");
@mysql_select_db("$bdd")
or die("Impossible de se connecter");
?>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery name="formulaire" datasource="hopem">
INSERT INTO Seminaire (Prenom, Nom, Compagnie, Telephone, Telecopieur, Courriel, Lieu, Moment, Langue, Soins, Commentaire)
VALUES (
<cfif IsDefined("FORM.PRENOM") AND #FORM.PRENOM# NEQ "">
'#FORM.PRENOM#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.NOM") AND #FORM.NOM# NEQ "">
'#FORM.NOM#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.COMPAGNIE") AND #FORM.COMPAGNIE# NEQ "">
'#FORM.COMPAGNIE#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.TELEPHONE") AND #FORM.TELEPHONE# NEQ "">
'#FORM.TELEPHONE#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.TELECOPIEUR") AND #FORM.TELECOPIEUR# NEQ "">
'#FORM.TELECOPIEUR#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.COURRIEL") AND #FORM.COURRIEL# NEQ "">
'#FORM.COURRIEL#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.LIEU") AND #FORM.LIEU# NEQ "">
'#FORM.LIEU#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.MOMENT") AND #FORM.MOMENT# NEQ "">
'#FORM.MOMENT#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.LANGUE") AND #FORM.LANGUE# NEQ "">
'#FORM.LANGUE#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.SOINS") AND #FORM.SOINS# NEQ "">
'#FORM.SOINS#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.COMMENTAIRE") AND #FORM.COMMENTAIRE# NEQ "">
'#FORM.COMMENTAIRE#'
<cfelse>
NULL
</cfif>
)
</cfquery>
</cfif>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HOPEM gestion d'immeuble compatabilité Formulaire session d'information version 2007</title>
<link href="Formulaire.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
nickadele
Messages postés1251Date d'inscriptionmercredi 7 août 2002StatutModérateurDernière intervention10 avril 2013 9 janv. 2008 à 09:07
Bonjour,
je ne comprend pas très bien ce que tu veux faire avec ceci :
<form method= "post" name="form1" /// JE CROIS QUE LE action="<cfoutput>query="formulaire"</cfoutput>">
La méthode "action" du form doit prendre le nom de la page qui va traîter ton formulaire, tout comme dans un autre language (php) :
<form method="post" name="form1" action="mapage.cfm">
Concernant le cfoutput ave query il s'utilise comme ceci :
<cfquery name ="listuser" datasource="hopem">
Select users.pseudo, users.mail
From users
</cfquery>