pb lors de la création d'un état

Eléphant du PHP | 66 Messages

24 juin 2006, 10:06

<?

if (isset($_POST['specialite']))
{
$specialite=$_POST['specialite'];
}
else
{
if (isset($_GET['specialite']))
{
$specialite=$_GET['specialite'];
}
else
{
$specialite="0";
}
}
// $link = mysql_connect("localhost", "root", "") or die("Impossible de se connecter");
// mysql_select_db("assistant") or die("Could not select database");
// $link = mysql_connect("mysql.rnu.tn", "uc", "usousse&06") or die("Impossible de se connecter");
// mysql_select_db("uc") or die("Could not select database");
include("base_loc.php");
// include("base.php");
$query = "SELECT * FROM assistant where specialite='$specialite' order by num_ordre";
$result = mysql_query($query) or die("1 query failed");

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
<title>Untitled Document</title>
</head>

<body>
<? $t=file("./textes.txt"); ?>
<? $e=file("./textes2.txt"); ?>
<? $tt=file("./entete.txt"); ?>
<? $line["specialite"]=$specialite ;?>

<center><table border="0" width=80% bgcolor='#FFFFFF'>
<tr>
<th> <p align="center" p><b2><? echo trim($tt[1]) ?></b2></th>
<th> <p align="center" p><b><? echo trim($tt[0]) ?></b></th>
</tr>
</table></center>

<center><table border="0" width=100% bgcolor='#aaaaaa'>
<tr>
<th> <p align="center" p><h1><b><? echo trim($e[0]) ?></b></h1></th>
</tr>
<tr>
<th> <p align="center" p><h1><b><? echo trim($e[1]) ?></b></h1></th>
</tr>

</table></center>
<? $sp=file("./spec.txt"); ?>

<form method="post" action="edition.php" name="consultation">

<h1 align="right" >
<select name="specialite" >
<option <? if (trim($line["specialite"]) == trim("$sp[0]")) {echo " selected ";} ?>><? echo $sp[0]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[1]")) {echo " selected ";} ?>><? echo $sp[1]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[2]")) {echo " selected ";} ?>><? echo $sp[2]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[3]")) {echo " selected ";} ?>><? echo $sp[3]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[4]")) {echo " selected ";} ?>><? echo $sp[4]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[5]")) {echo " selected ";} ?>><? echo $sp[5]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[6]")) {echo " selected ";} ?>><? echo $sp[6]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[7]")) {echo " selected ";} ?>><? echo $sp[7]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[8]")) {echo " selected ";} ?>><? echo $sp[8]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[9]")) {echo " selected ";} ?>><? echo $sp[9]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[10]")) {echo " selected ";} ?>><? echo $sp[10]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[11]")) {echo " selected ";} ?>><? echo $sp[11]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[12]")) {echo " selected ";} ?>><? echo $sp[12]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[13]")) {echo " selected ";} ?>><? echo $sp[13]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[14]")) {echo " selected ";} ?>><? echo $sp[14]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[15]")) {echo " selected ";} ?>><? echo $sp[15]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[16]")) {echo " selected ";} ?>><? echo $sp[16]; ?>
<option <? if (trim($line["specialite"]) == trim("$sp[17]")) {echo " selected ";} ?>><? echo $sp[17]; ?>
</select>
<? echo $e[2] ?> </h1>
<P align="right">
<p align="right">
Cliquez sur <input type="submit" value="Chercher specialité">
</p>
</form>

<div align="right">
<table width="100%" border="1" cellspacing=0 cellpadding=0 >
<tr>
<th rowspan="2" align="center"><? echo $e[24] ?></th>
<th rowspan="2" align="center"><? echo $e[23] ?></th>
<th rowspan="2" align="center"><? echo $e[22] ?></th>
<th rowspan="2" align="center"><? echo $e[21] ?></th>
<th colspan="2" align="center"><? echo $e[27] ?></th>
<th colspan="6" align="center"><? echo $e[25] ?></th>
<th colspan="6" align="center"><? echo $e[5] ?></th>
<th rowspan="2" align="center"><? echo $e[4] ?></th>
<th rowspan="2" align="center"><? echo $e[3] ?></th>
<th rowspan="2" align="center"><? echo $e[30] ?></th>
</tr>
<tr>
<th align="center"><? echo $e[20] ?></th>
<th align="center">&nbsp;</th>
<th align="center"><? echo $e[13] ?></th>
<th align="center"><? echo $e[19] ?></th>
<th align="center"><? echo $e[18] ?></th>
<th align="center"><? echo $e[17] ?></th>
<th align="center"><? echo $e[12] ?></th>
<th align="center"><? echo $e[11] ?></th>
<th align="center"><? echo $e[16] ?></th>
<th align="center"><? echo $e[9] ?></th>
<th align="center"><? echo $e[15] ?></th>
<th align="center"><? echo $e[8] ?></th>
<th align="center"><? echo $e[7] ?></th>
<th align="center"><? echo $e[6] ?></th>
</tr>

<?

$color=" bgcolor='#cccccc' ";

while ($line = mysql_fetch_array($result))
{
if (!($line["specialite"]=="")) { $specialite=$line["specialite"];}
if ($color == " bgcolor='#cccccc' ")
{
$color=" bgcolor='#ffffff' ";
}
else
{
$color=" bgcolor='#cccccc' ";
}
?>
<tr <? echo $color ?>>
<td width="2.5%" rowspan="6">&nbsp;</td>
<td width="2.5%" rowspan="6">&nbsp; </td>
<td width="2%" rowspan="6">&nbsp;</td>
<td width="2%" rowspan="6">&nbsp;</td>
<td width="2%" rowspan="6">&nbsp;</td>
<td width="14%" align="right" rowspan="6">
<p> : <? echo $t[18]; ?></p> <p>&nbsp; <? echo $line["encadreur"]; ?></p>
<p> : <? echo $t[19]; ?></p> <p> <? echo $line["sujet"]; ?></p>
<p> : <? echo $t[20]; ?></p> <p> <? echo $line["etab_master"];?></p> </td>
<td width="10%" align="right" >&nbsp; <? echo $line["etab_actsc_1"]; ?></td>
<td width="2%" align="right" >&nbsp;</td>
<td width="2%" align="right" >&nbsp;</td>
<td width="2%" align="right" >&nbsp;</td>
<td width="10%" align="right" >&nbsp;<? echo $line["nat_actsc_1"]; ?></td>
<td width="5%" align="right" >&nbsp;<? echo $line["an_actsc_1"]; ?></td>
<td width="2%" align="right">&nbsp;</td>
<td width="6%" align="right" >&nbsp;<? echo $line["obs_bac"]; ?></td>
<td width="2%" align="right">&nbsp;</td>
<td width="3%" align="right">&nbsp;<? echo $line["date_bac"]; ?></td>
<td width="5%" align="right" >&nbsp; <? echo $line["spec_bac"]; ?></td>
<td width="2.5%" align="right" ><? echo $t[25]; ?></td>
<td width="8.5%" align="right" rowspan="6"><? echo $line["nom"] ; ?>&nbsp;<? echo $line["prenom"] ; ?></td>
<td width="3%" align="right" rowspan="6">&nbsp;<? echo $line["num_cin"] ; ?></td>
<td width="2%" align="right" rowspan="6">&nbsp;<? echo $line["num_ordre"] ; ?></td>
</tr>
<tr <? echo $color ?>>
<td align="right">&nbsp;<? echo $line["etab_actsc_2"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["nat_actsc_2"]; ?></td>
<td align="right">&nbsp;<? echo $line["an_actsc_2"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right"> &nbsp;<? echo $line["obs_maitr"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["date_maitr"]; ?></td>
<td align="right">&nbsp;<? echo $line["spec_maitr"]; ?></td>
<td align="right">&nbsp;<? echo $t[26]; ?></td>
</tr>
<tr <? echo $color ?>>
<td align="right">&nbsp;<? echo $line["etab_actsc_3"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right"> &nbsp;<? echo $line["nat_actsc_3"]; ?></td>
<td align="right">&nbsp;<? echo $line["an_actsc_3"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["obs_mast"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["date_mast"]; ?></td>
<td align="right">&nbsp;<? echo $line["spec_mast"]; ?></td>
<td align="right">&nbsp;<? echo $t[27]; ?></td>
</tr>
<tr <? echo $color ?>>
<td align="right">&nbsp;<? echo $line["etab_actpf_1"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["nat_actpf_1"]; ?></td>
<td align="right">&nbsp;<? echo $line["an_actpf_1"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["obs_doc"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["date_doc"]; ?></td>
<td align="right">&nbsp;<? echo $line["spec_doc"]; ?></td>
<td align="right">&nbsp;<? echo $t[28]; ?></td>
</tr>
<tr <? echo $color ?>>
<td align="right">&nbsp;<? echo $line["etab_actpf_2"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["nat_actpf_2"]; ?></td>
<td align="right">&nbsp;<? echo $line["an_actpf_2"]; ?></td>
<td rowspan="2" align="right">&nbsp;</td>
<td rowspan="2" align="right">&nbsp;<? echo $line["obs_autr"]; ?></td>
<td rowspan="2" align="right">&nbsp;</td>
<td rowspan="2" align="right">&nbsp;<? echo $line["date_autr"]; ?></td>
<td rowspan="2" align="right">&nbsp;<? echo $line["spec_autr"]; ?></td>
<td rowspan="2" align="right">&nbsp;<? echo $t[29]; ?></td>
</tr>
<tr <? echo $color ?>>
<td align="right">&nbsp;<? echo $line["etab_actpf_3"]; ?></td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;</td>
<td align="right">&nbsp;<? echo $line["nat_actpf_3"]; ?></td>
<td align="right">&nbsp;<? echo $line["an_actpf_3"]; ?></td>
</tr>
<!-- fin personne -->




<?
}
if (trim($line["specialite"])=="") {$line["specialite"]=$specialite ;}
// echo("specialité xx = ") ;echo("$specialite");
// echo("linespecialité xx = ") ;echo($line["specialite"]);

?>
</table>

</div>

</body>
</html>
change <table width=100%>
met <table width=X>
X et la taille fixe du tableau
Mess With Best or die With the Rest

Eléphant du PHP | 51 Messages

24 juin 2006, 12:51

combien ça fait de pixel une page A3 en paysage?

Eléphant du PHP | 413 Messages

26 juin 2006, 11:29

en HTML, les largeurs de colonnes dépendent de leur contenu, sauf si tu les fixe avec des attributs width=... ou avec des styles CSS.
exemples :

Code : Tout sélectionner

<table width="100%">
cela mettra le tableau à la taille de la fenêtre.

ou bien

Code : Tout sélectionner

<td style="width:100px">
cela fixera la largeur de la colonne à 100 pixels.

combien ça fait de pixel une page A3 en paysage?
ça dépend.
si tu imprimes en 300 ppp (points par pouce), tu auras 300 pixels imprimés sur 2.5 cm (1 pouce = 2.5 cm).
Sur un A3, on a environ 20 cm. le nombre de pixels imprimés sera : 20/2.5*300 pixels (2400 pixels).
si tu imprimes en 600 ppp, ça fera 4800 pixels.

Et si tu dis à ton navigateur d'imprimer en taille 50% ou 150%, ça changera encore le nombre de pixels.
--
Goeb

Eléphant du PHP | 51 Messages

26 juin 2006, 12:48

merci pour ton aide, je vais essayer avec une largeur fixe, inchallah ça marchera