Affichage d'un formulaire HTML dans PHP
Bonjour,
je ve appliquer un style sur mon formulaire html avec une css et l'afficher dans un code php mais ca marche pas pouvez vous m'aider.
voici mon code php qui contient le formulaire:
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
<html>
<head>
<link rel='stylesheet' href='style.css' type='text/css'/>
</head>
<body>
<?php
mysql_connect('localhost','root','');
mysql_select_db('bd_dt');
$tab_resultat = array('','','','','','','','','','','','','','','','','','','','','');
$out = '';
$request ='select * from table1';
$result = mysql_query($request);
if($result)
{
if($tab_resultat = mysql_fetch_row($result))
{
for($i=0;$i<count($tab_resultat);$i++)
{
}
}
}
$out.="
<fieldset>
<legend>Résultat de la recherche</legend>
<div class='ResultRech'>
<span class='attribut'>Responsable:</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[5];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Date création :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[8].' hhh';
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Effectif global:</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[19];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Siège sociale :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[17];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Tel :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[9];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Fax :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[10];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>E-Mail :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[11];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Site web :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[12];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Activité:</span>
</div>
<div class ='affichage'>
<span class='result'>";
/*$varActv = $tab_resultat[1];
$request = 'select LIBELLE_ACT from activitees where NUM_ACT ='.$varActv;
$resultat = mysql_query($request);
if($resultat){
if($rowAct = mysql_fetch_row($resultat))
{
echo $rowAct[0];
}
}*/
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Statut juridique :</span>
</div>
<div class='affichage'>
<span class='result'>";
/*$varStatut = $tab_resultat[2];
$request2 = 'select LIBELLE_STATUT from statut_juridique where NUM_STATUT ='.$varStatut;
$resultat2 = mysql_query($request2);
if($resultat2)
{
if($rowStatut = mysql_fetch_row($resultat2))
{
echo $rowStatut[0];
}
}*/
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>N° police d'assurance :</span>
</div>
<div class='affichage'>
<span class='result'>";
echo $tab_resultat[14];
$out.="</span>
</div>
<div class='ResultRech'>
<span class='attribut'>Registre de commerce:</span>
</div>
<div class='affichage'>
<span class='result'>";
//echo $tab_resultat[20];
$out.="</span></div> </fieldset>";
mysql_close();
?>
</body></html> |
et voici la feuille de style que je ve appliquer:
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
| .{
font-family:arial ,verdana sans-serif;
font-size: 12px;
}
.ResultRech{
min-width:119px;
margin:5px 0 0 0;
background:red;
text-align:left;
float:left;
padding:0 0 0 5px;
}
.affichage{
min-width:133px;
margin:5px 0 0 0;
background:blue;
text-align:left;
float:left;
}
.attribut{
font-size:12px;
color:#0c5599;
}
.result{
font-size:12px;
color:black;
} |
et merci
Affichage d'un formulaire HTML dans PHP
Citation:
Envoyé par
jc_cornic
Salut peux-tu préciser qu'est-ce qui ne marche pas ?? est-ce l'affichage global ou un endroit en particulier ?
++
JC
oui c ca l'affichege global marche pas
Affichage d'un formulaire HTML dans PHP
ok merci il y avait juste un problme de test j'ai résolus le probléme avec ce code:
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
| <?php
if(isset($_POST['valider']))
{
if(isset($_POST['code_entre']) && isset($_POST['raison']) && isset($_POST['cnss']))
{
//if($_POST['code_entre']!="" || $_POST['raison']="" || $_POST['cnss']="")
//{
$request = "select * from entreprise where FICHE_ENTR = ".$_POST['code_entre']." and RAISON_SOCIALE = '".$_POST['raison']."' and CNSS = ".$_POST['cnss']." ";
$result = mysql_query($request);
if($result)
{
$tab_resultat = mysql_fetch_row($result);
if($tab_resultat)
{
/*for($i=0;$i<count($tab_resultat);$i++)
{}$var1=$tab_resultat[0];*/
$out1="<fieldset>
<legend>Résultat de la recherche</legend>
<div class=\"ResultRech\">
<span class=\"attribut\">Responsable:</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[5] && $tab_resultat[6]){
echo $out1;
echo $tab_resultat[5]." ". $tab_resultat[6];
}
$out2="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Date création :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[8]){
echo $out2;
echo $tab_resultat[8];
}
$out3="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Effectif global:</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[19]){
echo $out3;
echo $tab_resultat[19];
}
$out4="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Siège sociale :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[17]){
echo $out4;
echo $tab_resultat[17];
}
$out5="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Tel :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[9]){
echo $out5;
echo $tab_resultat[9];
}
$out6="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Fax :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[10]){
echo $out6;
echo $tab_resultat[10];
}
$out7="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">E-Mail :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[11]){
echo $out7;
echo $tab_resultat[11];
}
$out8="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Site web :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[12]){
echo $out8;
echo $tab_resultat[12];
}
$out9="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Activité:</span>
</div>
<div class =\"affichage\">
<span class=\"result\">";
if($tab_resultat[1])
{
echo $out9;
$varActv = $tab_resultat[1];
$request = "select LIBELLE_ACT from activitees where NUM_ACT =".$varActv;
$resultat = mysql_query($request);
if($resultat){
if($rowAct = mysql_fetch_row($resultat))
{
echo $rowAct[0];
}
}
}
$out10="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Statut juridique :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[2]){
echo $out10;
$varStatut = $tab_resultat[2];
$request2 = "select LIBELLE_STATUT from statut_juridique where NUM_STATUT =".$varStatut;
$resultat2 = mysql_query($request2);
if($resultat2)
{
if($rowStatut = mysql_fetch_row($resultat2))
{
echo $rowStatut[0];
}
}
}
$out11="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">N° police d'assurance :</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[14]){
echo $out11;
echo $tab_resultat[14];
}
$out12="</span>
</div>
<div class=\"ResultRech\">
<span class=\"attribut\">Registre de commerce:</span>
</div>
<div class=\"affichage\">
<span class=\"result\">";
if($tab_resultat[20]){
echo $out12;
echo $tab_resultat[20];
}
$out13="</span> </div></fieldset>";
//}
}
}
else
{
echo "<html>";
echo "<body>";
echo "<script langague = \"Javascript\">";
echo "alert(\"Veuillez remplire les chapms avant de lancer la recherche\")";
echo "</script>";
echo "</body>";
echo "</html>";
}
}
}
?> |
maintenant ca marche bien