Bonjour à tous.J'espère que vous vous éclatez bien.Moi,je suis en stage et je dois créer une base de données MySQL avec une interface PHP pour les enregistrements de la base,faire des stats sur la base...Le problème est que je n'arrive pas éxécuter mon code PHP(je travaille avec Easyphp Version 8.0).Je vous montre mon formulaire HTML :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
<title>Formulaire HTML</title>
</head>
<body>
<!--Listing 2.1 - formu.html -->
<FORM action="records26.php" method="post">
<H1><FONT color=black>NEW RECORD</FONT></H1>
<fieldset>
<legend>Please enter your informations:</legend>
<BR><BR>Client Name :<INPUT type="text" name="Client_Name" size="20" maxlength="40"/>
Company Name : <INPUT type="text" name="Company_Name" size="20" maxlength="40"/><BR><BR>
Date :<INPUT size="6" name="Date">(AAAA-MM-JJ) Time : <INPUT size="6" name="Time" >(HH:MM)<BR><BR>
Location : <SELECT name="Location">
<OPTION value="1" selected><OPTION value="2">Australia<OPTION value="3">Austria
<OPTION value="4">Belgium<OPTION
value="5">Czech Republic<OPTION value="6">Denmark<OPTION value="7">France
<OPTION value="8">Germany<OPTION
value="9">Holland<OPTION value="10">India<OPTION value="11">Ireland<OPTION value="12">Italy<OPTION value="13">Malaysia<OPTION value="14">Norway<OPTION value="15">South Africa<OPTION value="16">South Korea<OPTION value="17">Spain<OPTION value="18">Sweden<OPTION value="19">Switzerland<OPTION value="20">Turkey<OPTION value="21">UK<OPTION value="22">US<OPTION value="23">Other</OPTION></SELECT><BR><BR>
Phone Call :<INPUT type="checkbox" name="Phone_Call" value="YES"> Repeat Call :<INPUT type="checkbox" name="Repeat_Call" value="YES"> Email Call :<INPUT type="checkbox" name="Email_Call" value="YES"><BR><BR>
Pre Sales :<INPUT type="checkbox" name="Pre_Sales" value="YES"> Post sales :<INPUT type="checkbox" name="Post_Sales" value="YES"><BR><BR>
DT INFO :<INPUT type="checkbox" name="DT_INFO" value="YES"> Software Type : <INPUT name="Software_Type"><BR><BR>
Version : <INPUT name="Version"> Other S/W&Version : <INPUT name="Other_Version"><BR><BR>
Time Taken(Mins) : <INPUT name="Time_Taken_Mins"> CASE NO : <INPUT name="CASE_NO"><BR><BR>
Comments : <textarea name="Comments" rows="5" cols="50"></textarea><BR><BR>
</fieldset>
<div align="center"><INPUT type="submit" name="submit" value="Valider"></div></FORM><BR><A
href="http://localhost/statistics.html">Cliquer ici pour
faire des recherches ou afficher les statistiques </A><BR><BR><A
href="http://localhost/res.html">Cliquer ici pour
faire des recherches sur un appel précis </A>
</body>
</html>
puis mon code php qui va avec:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1"/>
<title>Accuse de reception de formulaire</title>
</head>
<body>
<BODY background="fondecran.jpg" vlink="black">
<H1><font color="red"> Record</font></H1>
<?php
$connection=mysql_pconnect("localhost","root");
if (!$connection)
{
echo "Désolé,connexion au serveur impossible\n";
exit;
}
if (!mysql_select_db("s_c_l_s",$connection))
{
echo "Désolé,accès à la base impossible\n";
exit;
}
//recuperation des variables
if(isset($_POST["Submit"])){
if(isset($_POST["Client_Name"])){
if(isset($_POST["Company_Name"])){
if(isset($_POST["Date"])){
if(isset($_POST["Time"])){
if(isset($_POST["Location"])){
if(isset($_POST["Phone_Call"])){
if(isset($_POST["Repeat_Call"])){
if(isset($_POST["Email_Call"])){
if(isset($_POST["Pre_Sales"])){
if(isset($_POST["DT_INFO"])){
if(isset($_POST["Software_Type"])){
if(isset($_POST["Version"])){
if(isset($_POST["Other_Version"])){
if(isset($_POST["Time_Taken_Mins"])){
if(isset($_POST["CASE_NO"])){
if(isset($_POST["Comments"])){
if(isset($_POST["Post_Sales"])){
//$Client_Name =$_POST['Client_Name'];
//$Company_Name=$_POST['Company_Name'];
//$Date=$_POST['Date'];
//$Time=$_POST['Time'];
//$Phone_Call=$_POST['Phone_Call'];
//$Repeat_Call=$_POST['Repeat_Call'];
//$Email_Call=$_POST['Email_Call'];
//$Pre_Sales=$_POST['Pre_Sales'];
//$Post_Sales=$_POST['Post_Sales'];
//$DT_INFO=$_POST['DT_INFO'];
//$Software_Type=$_POST['Software_Type'];
//$Version=$_POST['Version'];
//$Other_Version=$_POST['Other_Version'];
//$Time_Taken_Mins=$_POST['Time_Taken_Mins'];
//$CASE_NO=$_POST['CASE_NO'];
//$Comments=$_POST['Comments'];
include("config.inc");
//requete pour la table Company_Rafik
$requeteCompRk="INSERT INTO company_rafik(ID_NO,Client_Name,Company_Name,Date,Time,Phone_Call,Repeat_Call,Email_Call,Pre_Sales,Post_Sales,DT_INFO,Software_Type,Version,Location,Other_Version,Time_Taken_Mins,CASE_NO,Comments) values (NEXTVAL('SEQ_CLIENT')-1,'$Client_Name','$Company_Name','$Date','$Time','$Phone_Call','$Repeat_Call','$Email_Call','$Pre_Sales','$Post_Sales','$DT_INFO','$Software_Type','$Version','$Location','$Other_Version','$Time_Taken_Mins','$CASE_NO','$Comments')";
$resultat1=mysql_query($requeteCompRk,$connection);
}}}}}}}}}}}}}}}}}}
if(isset($resultat1))//si la mise à jour s'est bien effectuée
{echo"<p><b>New record.</b></p>";exit();}
else
{echo "<p>Record not done".
"<p></p>".mysql_error()."<p></p>";
}
mysql_close();
?>
</body>
</html>
Et voila le resultat que j 'obtiens quand je charge mon programme php dans mon navigateur:
Record
Record not done
Par conséquent,j ai l'impression qu'il n'y a rien dans $resultat1(ou meme peut-etre dans les variables recuperees de HTML).
En tout cas, je sais pas quoi faire et ca serait vraiment super sympa de regarder a quoi ressemble mon erreur.
Merci d'avance.
Ethan67
