Bonjour a tous,
je fais un site et je rencontre quelques problemes.
je n'arrive pas a me connecter a ma base de donnée
voici le code que j'ai pu mettre
pour la page insert.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
[ Lien ]">
<html>
<head>
<body>
<SCRIPT LANGUAGE="Javascript">
<!--
function champsok()
{
If (Nom.value.length==0)
{
alert ("Votre Nom svp");
return false;
}
If (prenom.value.length==0)
{
alert("votre prenom svp");
return false;
}
If (telephone.value.length==0)
{
alert("votre telephone svp");
return false;
}
return true;
}
//-->
</SCRIPT>
<title> document sans titre</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
</head>
<!--debut de php-->
<?php
$c=odbc_connect("mabase",",");
$requete="insert into ADHERENT
(num_adherent,Nom,prenom,telephone) values ("$_POST['num']."",$_POST['Nom'],$_POST['prenom]",$_POST['telephone')";
$query=odbc_exec($c,$requete);
odbc_close($c);
header("location:inscription.html)
?>
</body>
pour ma page principal inscription.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
[ Lien ]">
<!--début de la page html-->
<html>
<head>
<!--titre de la page-->
<title>insertion</title>
<meta http-equiv="Content-type"content="text/html;charset=iso-8859-1">
</head>
<body>
<!--debut de php-->
<?php
if($_POST['nom']=="",$_POST['prenom']=="",$_POST['telephone]=="")
{
?>
<script>
alert('Veuillez remplir tous les champs');
</script>
<?php
exit;
}
else
{
<?php
/*Connexion a la base*/
$c=odbc_connect("mabase",",");
?>
<p align="center"><font size="10"><b><i>
<marquee width="707" height="22" direction="right">"La Bretagne"</marquee>
</i></b></font></p>
<br>
<br>
<center><font size="4"><h2><u>Inscription</u></h2></center></font>
<table width="100%"><td width="5%"></td>
<td width="60%">
<form action="insert.php" method="POST">
<table width="100%"><td width="30%"align="MIDDLE"bgcolor="#6699FF">
<font size="4"color="#FFFFFF">Monsieur</font>
<INPUT type=radio name="Monsieur" value="M">
</td>
<BR>
<table width="100%"><td width="30%"align="MIDDLE"bgcolor="#6699FF">
<font size="4"color="#FFFFFF">Melle</font>
<INPUT type=radio name="Melle" value="F">
</TD>
<table width="100%"><td width="30%"align="MIDDLE"bgcolor="#6699FF">
<font size="4"color="#FFFFFF">Madame</font>
<INPUT type=radio name="madame" value="F">
</TD>
</TABLE>
<BR>
<table width="100%"><td width="30%"align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Votre Nom:</font>
</td><td>
<input type="text" name="nom">
</td></table><br>
<table width="100%"><td width="30%" align="middle"bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Votre Prénom:</font>
</td><td>
<input type="text" name="prénom">
</td></table><br>
<table width="100%"><td width="30%"align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Votre date de naissance:</font>
</td><td>
<input type="text" name="date de naissance">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Adresse:</font>
</td><td>
<input type="text" name="adresse">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Code postal:</font>
</td><td>
<input type="text" name="Code postal">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Ville:</font>
</td><td>
<input type="text" name="Ville">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Pays:</font>
</td><td>
<input type="text" name="Pays">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Adresse internet:</font>
</td><td>
<input type="text" name="Adresse internet">
</td></table><br>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Telephone:</font>
</td><td>
<input type="text" name="telephone">
</td></table>
</td><td width="10%"></td>
</table><br>
</td><td width="10%"></td>
</table>
<table width="100%"><td width="30%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Catégorie socio-professionnelle:</font>
</td><td>
<td valign="top"><table align="left"></td>
<select name="Sélectionner">
<option value=""selected>----Sélectionner une catégorie----</option>
<option value="1">Les agriculteurs exploitants </option>
<option value="2">Les artisans commerçants</option>
<option value="3">chefs dentreprises</option>
<option value="4">Les cadres</option>
<option value="5"> professions intellectuelles</option>
<option value="6">Les professions intermédiaires</option>
<option value="5">Les employés</option>
<option value="6">Les ouvriers</option>
<option value="7">Les retraités</option>
<option value="8">sans activité professionnelle</option>
</td></table>
<br>
<table width="60%"><td width="60%" align="middle" bgcolor="#6699FF">
<font size="4" color="#FFFFFF">Veuillez sélectionner 3 loisirs:</font>
</td><td>
<input type="checkbox" name="loisirs">
<font size="3">Lecture</font><br>
<input type="checkbox" name="loisirs">
<font size="3">Informatique</font><br>
<input type="checkbox" name="loisirs">
<font size="3">Cinéma</font><br>
<input type="checkbox" name="loisirs">
<font size="3">musique</font><br>
<input type="checkbox" name="loisirs">
<font size="3">cuisine</font><br>
<input type="checkbox" name="loisirs">
<font size="3">sport</font><br>
<input type="checkbox" name="loisirs">
<font size="3">Jardinage</font><br>
<input type="checkbox" name="loisirs">
<font size="3">modélisme</font><br>
</td></table>
<br>
<table width="100%"><td width="30%" align="middle">
<input type="submit" value="envoyer">
</td></table>
</form>
</td><td>
</td><td width="10%"></td>
</table><br>
</body>
</html>
je ne trouve pas mes erreurs
je n'arrive pas a me connecter a ma base
merci
lofely85