Probleme de formulaire sous Opera 9
Résolu
Chaouki84
-
avion-f16 Messages postés 19252 Date d'inscription Statut Contributeur Dernière intervention -
avion-f16 Messages postés 19252 Date d'inscription Statut Contributeur Dernière intervention -
Bonjour,
Depuis hier je me casse la tête sur mon probleme qui est décrit au titre, Bon... Il s'agit de formulaire suivant :
Dans la page Ajout.php :
<?php
echo "<form action='verif_ajout.php' enctype='multipart/form-data' method='post'><table>
<tr><td valign='top' align='right'>Type :</td><td>
<FORM>
<SELECT name='type' size='1'>
<OPTION>Pc de bureau
<OPTION>Pc Portable
<OPTION>Serveur
<OPTION>Ecran
<OPTION>Imprimante
<OPTION>Souris
<OPTION>Clavier
<OPTION>Scanner
<OPTION>Webcam
<OPTION>Joystick
<OPTION>Haut parleurs
<OPTION>Mp3
<OPTION>Processeur
<OPTION>Carte graphique
<OPTION>Carte mère
<OPTION>Disque dur
<OPTION>Disque externe
<OPTION>Graveur DVD
<OPTION>Clé USB
<OPTION>Modem
<OPTION>Switch
<OPTION>Routeur
<OPTION>Adapdateur
<OPTION>Boîtier
<OPTION>CD vièrge
<OPTION>DVD vièrge
<OPTION>Cartouche d'encre
<OPTION>Adaptateur
<OPTION>Câble réseau
<OPTION>2main_Pc de bureaux
<OPTION>2main_Pc portable
<OPTION>2main_Serveur
<OPTION>Pièces Pc de bureaux
<OPTION>Pièces Pc portable
</SELECT>
</FORM>
<br /><br /></td></tr>
<tr><td valign='top' align='right'>Marque :</td><td> <input type='text' name='marque'><br /><br /> </td></tr>
<tr><td valign='top' align='right'>Image :</td><td>
<INPUT type='file' name='image'> (La taille de l'image doit être inférieure à 100Ko)<br/><br/>
</td></tr>
<tr><td valign='top' align='right'>Description :</td><td> <textarea name='description' cols='40' rows='7'></textarea><br /><br /></td></tr>
<tr><td valign='top' align='right'>prix :</td><td> <input type='text' name='prix'><br /><br /> </td></tr>
<tr><td></td><td align='center'><input type='reset' value='Annuler'> <input type='submit' value='Valider'> </td></tr></table></form>" ;
?>
Dans la page verif_ajout.php :
<?php
$marque=$_POST["marque"];
$description=$_POST["description"];
$prix=$_POST["prix"];
$type=$_POST["type"];
$disp="oui";
$user = $_COOKIE["usname"];
$image = $_FILES["image"]["name"];
if($image=="")
{
$image="no_photo.jpg";
}
$nomTemporaire = $_FILES["image"]["tmp_name"] ;
$typeFichier = $_FILES["image"]["type"] ;
$poidsFichier = $_FILES["image"]["size"] ;
$codeErreur = $_FILES["image"]["error"] ;
$chemin = "C:\'Program Files\'EasyPHP1-8\'www\'TunisieDeStockage.com.tn\'images\'produits\'" ;
$chemin = str_replace('\'','',$chemin);
if(copy($nomTemporaire, $chemin.$image))
{ $z=1 ;}
else
{ $z=2 ;
}
if($marque=="" or $description=="" or $prix=="")
{
header("Location:erreur.php");
}
else
{
include("config1.php");
$res=mysql_query("insert into annonce(type,marque,image,description,prix,disp,user)
values('$type','$marque','$image','$description','$prix','$disp','$user')");
$res2=mysql_query("select code from annonce where type='$type' and marque='$marque' and description='$description' and prix='$prix' and disp='$disp' and user='$user' order by code");
$res3=mysql_query("select lien from jos_users where username='$user'");
if($a1=mysql_fetch_row($res3))
{$lien=$a1[0];}
if($a=mysql_fetch_row($res2))
{$id_an=$a[0];}
if($res)
{ $z=3;}
else {
$z=4;}
//variables de jos_content
$t1=mysql_query("select id from jos_sections where name like '$type'");
if($r1=mysql_fetch_row($t1))
{
$id_sec=$r1[0];}
$t2=mysql_query("select id from jos_categories where name like '$type'");
if($r2=mysql_fetch_row($t2))
{
$id_cat=$r2[0];}
$title=$type;
$title_alias=$type;
$state=1;
$sectionid=$id_sec;
$catid=$id_cat;
$mask=0;
$created=date("d-m-Y");
$created_by=62;
$modified=date("d-m-Y");
$modified_by=62;
$checked_out=0;
$version=1;
$parentid=0;
$access=0;
$hits=0;
$introtext="<b>marque :</b> ".$marque."<br/><br/><b>Description :</b> ".$description."<br/><br/><b>Prix :</b><font color=\'red\'> ".$prix."</font><br/><br/><a href=".$lien."><img src=\'images/contact.jpg\' width=\'111\' height=\'24\'></a>";
$desc="<img style=\"width: 461px; height: 6px\" src=\"http://127.0.0.1/TunisieDeStockage.com.tn/images/divers/bar2.png\" alt=\"a\" title=\"a\" width=\"461\" height=\"6\" /><br /><table border=\"0\" style=\"width: 460px; height: 81px\"><tbody><tr><td style=\"width: 150px\"> <div style=\"text-align: center\"><img style=\"width: 140px; height: 85px\" src=\"http://127.0.0.1/TunisieDeStockage.com.tn/images/produits/".$image."\" alt=\"a\" title=\"a\" width=\"140\" height=\"85\" /></div></td><td>".$introtext."</td></tr></tbody></table>";
$res2=mysql_query("insert into jos_content(title,title_alias,introtext,state,sectionid,catid,mask,created,created_by,modified,modified_by,checked_out,version,parentid,access,hits,id_an)
values('$title','$title_alias','$desc','$state','$sectionid','$catid','$mask','$created','$created_by','$modified','$modified_by','$checked_out','$version','$parentid','$access','$hits','$id_an')");
if($res2)
{
$z=5;
}
header("Location:modifier.php");
}
?>
Bon.. Le problème est que ce code marche bien sous Firefox mais sous Opera 9 , il ne reussit pas, et m'affiche ces erreurs :
Notice: Undefined index: marque in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 2
Notice: Undefined index: description in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 3
Notice: Undefined index: prix in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 4
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 8
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 13
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 14
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 15
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 16
Merci de m'aider, Merci d'avance
Depuis hier je me casse la tête sur mon probleme qui est décrit au titre, Bon... Il s'agit de formulaire suivant :
Dans la page Ajout.php :
<?php
echo "<form action='verif_ajout.php' enctype='multipart/form-data' method='post'><table>
<tr><td valign='top' align='right'>Type :</td><td>
<FORM>
<SELECT name='type' size='1'>
<OPTION>Pc de bureau
<OPTION>Pc Portable
<OPTION>Serveur
<OPTION>Ecran
<OPTION>Imprimante
<OPTION>Souris
<OPTION>Clavier
<OPTION>Scanner
<OPTION>Webcam
<OPTION>Joystick
<OPTION>Haut parleurs
<OPTION>Mp3
<OPTION>Processeur
<OPTION>Carte graphique
<OPTION>Carte mère
<OPTION>Disque dur
<OPTION>Disque externe
<OPTION>Graveur DVD
<OPTION>Clé USB
<OPTION>Modem
<OPTION>Switch
<OPTION>Routeur
<OPTION>Adapdateur
<OPTION>Boîtier
<OPTION>CD vièrge
<OPTION>DVD vièrge
<OPTION>Cartouche d'encre
<OPTION>Adaptateur
<OPTION>Câble réseau
<OPTION>2main_Pc de bureaux
<OPTION>2main_Pc portable
<OPTION>2main_Serveur
<OPTION>Pièces Pc de bureaux
<OPTION>Pièces Pc portable
</SELECT>
</FORM>
<br /><br /></td></tr>
<tr><td valign='top' align='right'>Marque :</td><td> <input type='text' name='marque'><br /><br /> </td></tr>
<tr><td valign='top' align='right'>Image :</td><td>
<INPUT type='file' name='image'> (La taille de l'image doit être inférieure à 100Ko)<br/><br/>
</td></tr>
<tr><td valign='top' align='right'>Description :</td><td> <textarea name='description' cols='40' rows='7'></textarea><br /><br /></td></tr>
<tr><td valign='top' align='right'>prix :</td><td> <input type='text' name='prix'><br /><br /> </td></tr>
<tr><td></td><td align='center'><input type='reset' value='Annuler'> <input type='submit' value='Valider'> </td></tr></table></form>" ;
?>
Dans la page verif_ajout.php :
<?php
$marque=$_POST["marque"];
$description=$_POST["description"];
$prix=$_POST["prix"];
$type=$_POST["type"];
$disp="oui";
$user = $_COOKIE["usname"];
$image = $_FILES["image"]["name"];
if($image=="")
{
$image="no_photo.jpg";
}
$nomTemporaire = $_FILES["image"]["tmp_name"] ;
$typeFichier = $_FILES["image"]["type"] ;
$poidsFichier = $_FILES["image"]["size"] ;
$codeErreur = $_FILES["image"]["error"] ;
$chemin = "C:\'Program Files\'EasyPHP1-8\'www\'TunisieDeStockage.com.tn\'images\'produits\'" ;
$chemin = str_replace('\'','',$chemin);
if(copy($nomTemporaire, $chemin.$image))
{ $z=1 ;}
else
{ $z=2 ;
}
if($marque=="" or $description=="" or $prix=="")
{
header("Location:erreur.php");
}
else
{
include("config1.php");
$res=mysql_query("insert into annonce(type,marque,image,description,prix,disp,user)
values('$type','$marque','$image','$description','$prix','$disp','$user')");
$res2=mysql_query("select code from annonce where type='$type' and marque='$marque' and description='$description' and prix='$prix' and disp='$disp' and user='$user' order by code");
$res3=mysql_query("select lien from jos_users where username='$user'");
if($a1=mysql_fetch_row($res3))
{$lien=$a1[0];}
if($a=mysql_fetch_row($res2))
{$id_an=$a[0];}
if($res)
{ $z=3;}
else {
$z=4;}
//variables de jos_content
$t1=mysql_query("select id from jos_sections where name like '$type'");
if($r1=mysql_fetch_row($t1))
{
$id_sec=$r1[0];}
$t2=mysql_query("select id from jos_categories where name like '$type'");
if($r2=mysql_fetch_row($t2))
{
$id_cat=$r2[0];}
$title=$type;
$title_alias=$type;
$state=1;
$sectionid=$id_sec;
$catid=$id_cat;
$mask=0;
$created=date("d-m-Y");
$created_by=62;
$modified=date("d-m-Y");
$modified_by=62;
$checked_out=0;
$version=1;
$parentid=0;
$access=0;
$hits=0;
$introtext="<b>marque :</b> ".$marque."<br/><br/><b>Description :</b> ".$description."<br/><br/><b>Prix :</b><font color=\'red\'> ".$prix."</font><br/><br/><a href=".$lien."><img src=\'images/contact.jpg\' width=\'111\' height=\'24\'></a>";
$desc="<img style=\"width: 461px; height: 6px\" src=\"http://127.0.0.1/TunisieDeStockage.com.tn/images/divers/bar2.png\" alt=\"a\" title=\"a\" width=\"461\" height=\"6\" /><br /><table border=\"0\" style=\"width: 460px; height: 81px\"><tbody><tr><td style=\"width: 150px\"> <div style=\"text-align: center\"><img style=\"width: 140px; height: 85px\" src=\"http://127.0.0.1/TunisieDeStockage.com.tn/images/produits/".$image."\" alt=\"a\" title=\"a\" width=\"140\" height=\"85\" /></div></td><td>".$introtext."</td></tr></tbody></table>";
$res2=mysql_query("insert into jos_content(title,title_alias,introtext,state,sectionid,catid,mask,created,created_by,modified,modified_by,checked_out,version,parentid,access,hits,id_an)
values('$title','$title_alias','$desc','$state','$sectionid','$catid','$mask','$created','$created_by','$modified','$modified_by','$checked_out','$version','$parentid','$access','$hits','$id_an')");
if($res2)
{
$z=5;
}
header("Location:modifier.php");
}
?>
Bon.. Le problème est que ce code marche bien sous Firefox mais sous Opera 9 , il ne reussit pas, et m'affiche ces erreurs :
Notice: Undefined index: marque in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 2
Notice: Undefined index: description in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 3
Notice: Undefined index: prix in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 4
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 8
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 13
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 14
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 15
Notice: Undefined index: image in c:\program files\easyphp1-8\www\tunisiedestockage.com.tn\revendeur\verif_ajout.php on line 16
Merci de m'aider, Merci d'avance
A voir également:
- Probleme de formulaire sous Opera 9
- Whatsapp formulaire opposition - Guide
- Opera mini pc - Télécharger - Navigateurs
- Formulaire de réclamation facebook - Guide
- Formulaire de reclamation instagram - Guide
- Video downloadhelper opera ✓ - Forum Opera
5 réponses
Ces erreurs n'ont rien à voir avec Opera mais c'est ton code PHP qui fait ça.
De plus, ton formulaire n'est pas valide : retourne lire des tutoriels et revient quand tu auras un formulaire valide XHTML !
De plus, ton formulaire n'est pas valide : retourne lire des tutoriels et revient quand tu auras un formulaire valide XHTML !
C'est normal.
Quand tu récupères les valeurs de variables globales type $_POST tu dois d'abord vérifier qu'elles ne sont pas vides.
Donc :
$marque=$_POST["marque"];
$description=$_POST["description"];
$prix=$_POST["prix"];
$type=$_POST["type"];
If faut que pour chacune tu fasse :
if ( isset($_POST['marque']) ) {
$marque = $_POST['marque'];
} else {
$marque ="";
}
Fais ça pour chacune de tes valeurs (y compris les cookies, session ,etc)
Quand tu récupères les valeurs de variables globales type $_POST tu dois d'abord vérifier qu'elles ne sont pas vides.
Donc :
$marque=$_POST["marque"];
$description=$_POST["description"];
$prix=$_POST["prix"];
$type=$_POST["type"];
If faut que pour chacune tu fasse :
if ( isset($_POST['marque']) ) {
$marque = $_POST['marque'];
} else {
$marque ="";
}
Fais ça pour chacune de tes valeurs (y compris les cookies, session ,etc)
J'ai essayer de normaliser la page , j'ai ajouter le bout de code au debut de la page :
<!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" xml:lang="fr" lang="fr">
<head>
<title>TunisieDestockage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="fr" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="DC.Language" scheme="RFC3066" content="fr" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Normal" />
</head>
puis j'ai utiliser les isset comme m'indique Passarinho44 mais quand je fait submit, la page suivante est vide, comme ci Opera ne concidère pas les POST et les GET.
Merci de m'aider, Merci d'avance
<!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" xml:lang="fr" lang="fr">
<head>
<title>TunisieDestockage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="fr" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="DC.Language" scheme="RFC3066" content="fr" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="Normal" />
</head>
puis j'ai utiliser les isset comme m'indique Passarinho44 mais quand je fait submit, la page suivante est vide, comme ci Opera ne concidère pas les POST et les GET.
Merci de m'aider, Merci d'avance
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question