8722 sujets

Développement web côté serveur, CMS

bonjour

je veux updater la table operateur et les adresses de ce dernier dans la table adresse
mais aucune modif n'est prise en compte !!
voici ma modifier-op.php
<?php
include('haut.php');
include('connect.php');
?>			 
<section>
	<article>
		<header>
		<h2>Modifier Un Op&eacute;rateur</h2>
		</header>
<?php		
$con=pdoconnect();
		extract($_GET);
//EDITION  de l'OP choisi  dans le formulaire
 		$req=$con->prepare('SELECT * FROM operateur O,adresse A 
		WHERE  O.ID_OP=A.ID_OP  AND O.ID_OP=:id ') or die($con->errorInfo());
		$req->bindParam(':id',$id,PDO::PARAM_INT);
		$req->execute();
		$data=$req->fetch();
		
//Update de la Op&eacute;rateur en question utilisation du post de ce formulaire 
//var_dump($_POST );
if (isset($_POST['modifier']) AND isset($_POST['NOMOP']) AND isset($_POST['EMAILOP']) 
AND isset($_POST['CONT1']) AND isset($_POST['CONT2']) 
AND isset($_POST['CONT3'])AND isset($_POST['TELT']) AND isset($_POST['TELF']) 
AND isset($_POST['ADR1']) AND isset($_POST['ADR2']) AND isset($_POST['ADRCP'])
AND isset($_POST['ADRV']) 
AND !empty($_POST['NOMOP']) AND !empty($_POST['EMAILOP']) AND !empty($_POST['CONT1'])
AND !empty($_POST['CONT2']) 
AND !empty($_POST['CONT3']) AND !empty($_POST['TELT']) AND !empty($_POST['TELF']) 
AND !empty($_POST['ADR1']) AND !empty($_POST['ADR2']) AND !empty($_POST['ADRCP']) 
AND !empty($_POST['ADRV'])   )
{
$idop=(int)$_POST['id'];
extract($_POST);

$req=$con->prepare("UPDATE operateur O,JOIN adresse  A ON O.ID_OP = A.ID_OP
SET O.NOM_OP=:NOMOP,O.EMAIL_OP=:EMAILOP,O.CONTACT1=:CONT1,O.CONTACT2=:CONT2,
O.CONTACT3=:CONT3,O.TEL_OP=:TELT,O.FAX_OP=:TELF,
A.ADR_LIGNE1=:ADR1,A.ADR_LIGNE2=:ADR2,A.ADR_CP=:ADRCP,A.ADR_VILLE=:ADRV
 WHERE O.ID_OP=$idop ") or die ($con->errorInfo());

$req->execute(array(
'NOMOP'=>$NOMOP,
'EMAILOP'=>$EMAILOP ,
'CONT1'=>$CONT1 ,
'CONT2'=>$CONT2,
'CONT3'=>$CONT3,
'TELT'=>$TELT,
'TELF'=>$TELF,
'ADR1'=>$ADR1,
'ADR2'=>$ADR2,
'ADRCP'=>$ADRCP,
'ADRV'=>$ADRV ));
PRINT_R($req);

echo'l Op&eacute;rateur ' .$NOMOP. ' à bien été Modifiée';
}?>
<form class="form " action="modifier-op.php" method="POST"  >
<input name="idop" type="hidden" value="<?php echo $data['ID_OP'];?>"; />
<label >Nom Operateur: </label>
<input type="text" name="NOMOP" value="<?php echo $data['NOM_OP'];?>" required />
<label>Email Operateur: </label>
<input type="EMAIL" name="EMAILOP" value="<?php echo $data['EMAIL_OP'];?>"  required  />
<label for="CONT1">CONACT1 </label>
<input type="text" name="CONT1" value="<?php echo $data['CONTACT1'];?>"  required />
<label for="CONT2">CONACT2 </label>
<input type="text" name="CONT2" value="<?php echo $data['CONTACT2'];?>"   />
<label for="CONT3">CONACT3 : </label>
<input type="text" name="CONT3" value="<?php echo $data['CONTACT3'];?>"   />
<label>TELEPHONE : </label>
<input type="tel" name="TELT" value="<?php echo $data['TEL_OP'];?>" required  />
<label>FAX : </label>
<input type="tel" name="TELF" value="<?php echo $data['FAX_OP'];?>"   />
<label>Adresse 1: </label>
<input type="text" name="ADR1" value="<?php echo $data['ADR_LIGNE1'];?>"  />
<label for="ADR2">Adresse 2: </label>
<input type="text" name="ADR2" value="<?php echo $data['ADR_LIGNE2'];?>"  />
<label for="ADRCP">Adresse CP</label>
<input type="text" name="ADRCP" value="<?php echo $data['ADR_CP'];?>"  />
<label for="ADRV">Adresse VILLE: </label>
<input type="text" name="ADRV"  value="<?php echo $data['ADR_VILLE'];?>"  />
<input type="submit" value="Retour" class="clear" name="Retour" onclick="history.go(-1)">
<input type="submit" value="Modifier" class="clear" name="modifier" >
</form>

</div>
<div class="adress"></div>

<p>  <a href="gestionop.php"> Retour au menu de gestion Principal des Op&eacute;rateurs </a> </p>	

Modifié par beddiaf (13 Aug 2017 - 22:53)
Bonjour.

UPDATE operateur O,JOIN adresse  A ON O.ID_OP = A.ID_OP SET O.NOM_OP=:NOMOP,O.EMAIL_OP=:EMAILOP,O.CONTACT1=:CONT1,O.CONTACT2=:CONT2,
O.CONTACT3=:CONT3,O.TEL_OP=:TELT,O.FAX_OP=:TELF,
A.ADR_LIGNE1=:ADR1,A.ADR_LIGNE2=:ADR2,A.ADR_CP=:ADRCP,A.ADR_VILLE=:ADRV
 WHERE O.ID_OP=$idop

J'ai quelques doutes sur votre syntaxe : pourquoi une virgule entre operateur O et JOIN ?

Ensuite pourquoi utiliser à la fin :
 WHERE O.ID_OP=$idop

quand vous utilisez majoritairement des étiquettes(:NOMOP, :EMAILOP, :CONT1…) ?

Smiley sweatdrop