Créer des div selon variables récupérées
Bonjour,
J'ai un problème pour construire une page.
J'ai envoyé des variable avec une boucle for each avec flash.Le fichier les récupère bien mais je souhaiterais faire une div différente avec chaque variable reçu.Je vous montre ce que j'ai commencé:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
| <?php
require('config.php');
header("Cache-control: private, no-cache");
header("Pragma: no-cache");
header ("Last-Modified: " . gmdate ("D, d M Y H:i:s") . " GMT");
$erreurs = array(); //initialise un tableau d'erreurs au cas ou :)
$connect=mysql_connect(DB_HOST,DB_LOGIN,DB_PASS) or die ('erreur de connexion');
mysql_select_db(DB_BDD) or die ('erreur de connexion à la base');
if(!empty($_POST['url']))
{$url=$_POST['url'];
echo''.$url.'<br/>'
;
}
if(!empty($_POST['link']))
{$lienimage=$_POST['link'];
echo''.$lienimage.'<br/>';}
if(!empty($_POST['nom'])){
$ensemblenom=array($_POST['nom']);
foreach($ensemblenom as $nom)
{
$nom = mysql_escape_string(trim($_POST['nom']));
echo''.$nom.',<br/>';
}
}
if(!empty($_POST['large'])){
$ensemblewidth=array($_POST['large']);
foreach($ensemblewidth as $width)
{
$width = mysql_escape_string(trim($_POST['large']));
echo''.$width.'<br/>';
}
}
if(!empty($_POST['haut'])){
$ensembleheight=array($_POST['haut']);
foreach($ensembleheight as $height)
{
$height = mysql_escape_string(trim($_POST['haut']));
echo''.$height.'<br/>';
}
}
if(!empty($_POST['positionX'])){
$ensembleposx=array($_POST['positionX']);
foreach($ensembleposx as $posX)
{
$posX = mysql_escape_string(trim($_POST['positionX']));
echo''.$posX.'<br/>';
}
}
if(!empty($_POST['positionY'])){
$ensembleposy=array($_POST['positionY']);
foreach($ensembleposy as $posY)
{
$posY = mysql_escape_string(trim($_POST['positionY']));
echo''.$posY.'<br/>';
}
}
$requeteinsert = 'INSERT INTO preview(nom,lienimage,posX,posY,url,width,height) VALUES(\''.$nom.'\',\''.$lienimage.'\',\''.$posX.'\',\''.$posY.'\',\''.$url.'\',\''.$width.'\',\''.$height.'\')';
$result = mysql_query($requeteinsert,$connect);
echo '<p >Preview bien enregistrée!</p>';
mysql_close($connect);
?>
<?php
//création du message d'erreur
if(!empty($erreurs))
{
echo '<div class="error">
<p>Erreurs rencontrées</p>
<ul>';
foreach($erreurs as $erreur)
{
echo '<li>'.$erreur.'</li>';
}
echo '</ul>
</div>';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="expires" content="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Aperçu de votre campagne</title>
<style type="text/css">
<!--
body {
background-color: white;
}
div{
<?php echo "width: ".$width."px"?>;
<?php echo "height:".$height."px"?>;
}
#background{ width:100% ;
height:100%;
}
-->
</style></head>
<center>
<body>
<?php
echo"<div style='position:absolute;top:".$posY."px; left:".$posX."px;' >
<img src='../imagesLoader/".$lienimage."' id='background' />
</div>
<iframe src='http://".$url."' width='1024' height='800'> </iframe>"
?>
</body>
</center>
</html> |
C'est cette div que j'aimerai changé selon le nombre d'attribue reçu
echo"<div style='position:absolute;top:".$posY."px; left:".$posX."px;' >
<img src='../imagesLoader/".$lienimage."' id='background' />
</div>
Merci