IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

Syntaxe html dans code php [MySQL]


Sujet :

PHP & Base de données

  1. #1
    Membre confirmé
    Inscrit en
    Juillet 2009
    Messages
    107
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 107
    Par défaut Syntaxe html dans code php
    Bonjour,
    J'ai un problème pour intégrer ce code pour liste déroulante dans mon code php, je ne sais pas comment gérer la syntaxe. Est-ce que vous pouvez m'aider ? Merci beaucoup !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <select name="emplacement">
    	<option <?php if($emplacement == "Haut") echo "selected"; ?> value="Haut">Haut</option>
    	<option <?php if($emplacement == "Bas") echo "selected"; ?> value="Bas">Bas</option>
    	</select>


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    <?php
    					$connect = mysql_connect(MYHOST, MYUSER, MYPASS)  or die ('Identifiants incorrects');  
    					mysql_select_db(MYDB) or die ('Base de données incorrecte');  
    					$requete = "SELECT id,titre,lien,texte,img FROM slider ORDER BY id";
    					$result = mysql_query($requete);
    					if(mysql_num_rows($result)){
    						while($cur_item = mysql_fetch_assoc($result)){
    							echo '<form method="post" enctype="multipart/form-data" style="display:block;float:left;width:270px;background-color: #E6EFF7;padding:10px">
    									<fieldset style="border: 1px solid #73aad2;padding:7px;margin:3px;">
    										<legend style="font-size:1.8em;display:block;margin-left:200px;position:absolute;">'.$cur_item['id'].'</legend>
    										<input type="hidden" class="loginRemplissage" name="slide" id="idslide" value="'.$cur_item['id'].'" /><br />
    										<input type="hidden" class="loginRemplissage" name="modif" id="modif" value="true" />
    										
    										<label for="titre" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding-right: 5px;display:block;
    	float:left;vertical-align: middle;" >Titre</label><input type="text" size="30" class="loginRemplissage" name="titre" value="'.htmlspecialchars($cur_item['titre']).'"/><br />
    										<label for="lien" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;" >Lien</label><input type="text" size="30" class="loginRemplissage" name="lien" value="'.htmlspecialchars($cur_item['lien']).'" /><br /><br />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;">Description</label><textarea style="float:left;width:230px;margin:3px;color:#555;height:100px;" name="description">'.htmlspecialchars($cur_item['texte']).'</textarea><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;">Image</label><input type="file" style="float:left;width:230px;margin:3px;color:#555;" name="image" /><br /><br />
    										<img class="miniature" src="'.htmlspecialchars($dossierImages.$cur_item['img']).'" alt="image du slide" />
    										
    										<br />
    										<label for="emplacement" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Emplacement :</label>
    	
    	<select name="emplacement">
    	<option <?php if($emplacement == "Haut") echo "selected"; ?> value="Haut">Haut</option>
    	<option <?php if($emplacement == "Bas") echo "selected"; ?> value="Bas">Bas</option>
    	</select>
     
     
    	<br /><br />
     
     
     
    										<button type="submit" class="button blue small3"  style="cursor:pointer">Modifier</button>
    										<a class="supprimer" href="javascript:void(0)">Supprimer</a>
    										<a class="positionplus" href="javascript:void(0)" style="color: #3779AA;">+</a>
    										<a class="positionmoins" href="javascript:void(0)" style="color: #3779AA;">-</a>
    									</fieldset>
    							</form>';	
    						}
     
    					} else{
    						echo '<form method="post" enctype="multipart/form-data" class="formulaireSlide">
    									<fieldset>
    										<legend style="font-size:1.8em;display:block;margin-left:200px;position:absolute;">1</legend>
    										<input type="hidden" name="slide" id="idslide" value="1" />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Titre</label><input type="text" name="titre" value=""/>
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Lien</label><input type="text" name="lien" value="" /><br /><br />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Description</label><textarea name="description" style="float:left;width:180px;margin:3px;color:#555;height:100px;"></textarea>
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Image</label><input type="file" name="image" />
    	<br />
     
    	<label for="emplacement" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Emplacement :</label>
     
    	<select name="emplacement">
    	<option <?php if($emplacement == "Haut") echo "selected"; ?> value="Haut">Haut</option>
    	<option <?php if($emplacement == "Bas") echo "selected"; ?> value="Bas">Bas</option>
    	</select>
     
    	<br /><br />

  2. #2
    Membre émérite
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Par défaut
    Salut,

    Essaye comme ca :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    echo '<form method="post" enctype="multipart/form-data" style="display:block;float:left;width:270px;background-color: #E6EFF7;padding:10px">
    									<fieldset style="border: 1px solid #73aad2;padding:7px;margin:3px;">
    										<legend style="font-size:1.8em;display:block;margin-left:200px;position:absolute;">'.$cur_item['id'].'</legend>
    										<input type="hidden" class="loginRemplissage" name="slide" id="idslide" value="'.$cur_item['id'].'" /><br />
    										<input type="hidden" class="loginRemplissage" name="modif" id="modif" value="true" />
     
    										<label for="titre" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding-right: 5px;display:block;
    	float:left;vertical-align: middle;" >Titre</label><input type="text" size="30" class="loginRemplissage" name="titre" value="'.htmlspecialchars($cur_item['titre']).'"/><br />
    										<label for="lien" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;" >Lien</label><input type="text" size="30" class="loginRemplissage" name="lien" value="'.htmlspecialchars($cur_item['lien']).'" /><br /><br />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;">Description</label><textarea style="float:left;width:230px;margin:3px;color:#555;height:100px;" name="description">'.htmlspecialchars($cur_item['texte']).'</textarea><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
    										<label style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;padding-right: 5px;">Image</label><input type="file" style="float:left;width:230px;margin:3px;color:#555;" name="image" /><br /><br />
    										<img class="miniature" src="'.htmlspecialchars($dossierImages.$cur_item['img']).'" alt="image du slide" />
     
    										<br />
    										<label for="emplacement" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #3779AA;margin-left: 4px;font-weight: normal;
    margin-bottom: 0px;margin-top: 0px;text-align: right;padding: 0px;display:block;
    	float:left;">Emplacement :</label>
     
    	<select name="emplacement">
    	<option ';
    if($emplacement == "Haut") echo '"selected"'; 
    echo 'value="Haut">Haut</option>
    	<option ';
    if($emplacement == "Bas") echo '"selected"';
    echo 'value="Bas">Bas</option>
    	</select>
     
     
    	<br /><br />
     
     
     
    										<button type="submit" class="button blue small3"  style="cursor:pointer">Modifier</button>
    										<a class="supprimer" href="javascript:void(0)">Supprimer</a>
    										<a class="positionplus" href="javascript:void(0)" style="color: #3779AA;">+</a>
    										<a class="positionmoins" href="javascript:void(0)" style="color: #3779AA;">-</a>
    									</fieldset>
    							</form>';

  3. #3
    Membre confirmé
    Inscrit en
    Juillet 2009
    Messages
    107
    Détails du profil
    Informations forums :
    Inscription : Juillet 2009
    Messages : 107
    Par défaut
    Merci amoiraud, ça marche comme ça !
    Bonne journée,

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Tableaux] stocker code source html dans variable php
    Par vonwolf dans le forum Langage
    Réponses: 5
    Dernier message: 12/12/2007, 22h40
  2. [PHP-JS] Popup d'alerte - insertion dans code PHP ?
    Par bilou95 dans le forum Langage
    Réponses: 2
    Dernier message: 28/11/2006, 16h28
  3. balise div dans code php
    Par mealtone dans le forum Langage
    Réponses: 3
    Dernier message: 11/08/2006, 19h21
  4. code html dans du php
    Par dams78 dans le forum Langage
    Réponses: 6
    Dernier message: 17/03/2006, 11h06
  5. [MySQL] Erreur dans code php
    Par Badr3am dans le forum PHP & Base de données
    Réponses: 11
    Dernier message: 31/01/2006, 22h16

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo