I can't show my CSS into PHP pages:
I have this PHP page where i wrote my CSS (stile.php):
<?php
header("Content-type: text/css");
$url = "http://sitename.com/files/greenbutton.png";
$colore = "#000000";
?>
a
{ background: <?echo $url;?>;
color: <?echo $colore;?>; }
This is my PHP page:
<html>
<head>
<title>Pagina dei Risultati</title>
<link rel="stylesheet" type="text/css" href="http://sitename.com/stile.php"/>
</head>
<title>Pagina dei Risultati</title>
<link rel="stylesheet" type="text/css" href="http://sitename.com/stile.php"/>
<?php
$db = mysql_connect('localhost','','') or die ('Impossibile connettersi');
mysql_select_db('my_palmiano', $db) or die(mysql_error($db));
$cognome=$_POST['cognome'];
$nome=$_POST['nome'];
if(empty($cognome) & empty($nome)) { ?>
<p align="center">Si deve inserire un Nome od un Cognome.</p>
<p align="center"><a href="http://sitename.com/cercaform.html">Torna alla pagina di Ricerca.</a></p>
<?php
exit();}
$sql = "SELECT * FROM Defunti WHERE cognome LIKE '%" . $cognome . "%' AND nome LIKE '%" . $nome . "%' ORDER BY cognome";
$result =mysql_query($sql, $db) or die (mysql_error($db));
$contatore= mysql_num_rows($result);
?>
<div style="text-align: center;">
<?php echo '<h2>'.'Risultati Trovati: '. $contatore.'</h2>';?>
<table border="1" bordercolor="black" cellpadding="2" cellspacing="2" style="width: 100%; margin-left: auto; margin-right: auto; text-align: center;">
<tr>
<th>Cognome</th>
<th>Nome</th>
<th>Nascita</th>
<th>Decesso</th>
<th>Età</th>
<th>Cimitero di</th>
<th>Settore</th>
<th>Numero</th>
<th>Mappa</th>
<th>Note</th>
</tr>
<?php
function calcola_eta($ggnascita,$mmnascita,$aaaanascita,$ggdecesso,$mmdecesso,$aaaadecesso){
if ($ggnascita==0 || $mmnascita==0 || $aaaanascita==0 || $ggdecesso==0 || $mmdecesso==0 || $aaaadecesso==0){
return 'ND';
}
if ($aaaanascita==$aaaadecesso ){
return '-';}
if ($aaaanascita<$aaaadecesso & $mmnascita < $mmdecesso){
return (( $aaaadecesso - $aaaanascita) - 1);}
if ($aaaanascita<$aaaadecesso & $mmnascita > $mmdecesso){
return $aaaadecesso - $aaaanascita;
}
if ($aaaanascita<$aaaadecesso & $mmnascita==$mmdecesso){
if ($ggnascita >= $ggdecesso) {
return $aaaadecesso - $aaaanascita;
}
if ($aaaanascita<$aaaadecesso & $mmnascita==$mmdecesso){
if ($ggnascita < $ggdecesso) {
return (( $aaaadecesso - $aaaanascita) - 1);}
else { return 0;}
}
}}
while($row=mysql_fetch_array($result)){
extract($row);
echo '<tr>';
echo '<td>' . $cognome . '</td>';
echo '<td>' . $nome. '</td>';
echo '<td>' . $ggnascita . '/'. $mmnascita . '/'. $aaaanascita . '</td>';
echo '<td>' . $ggdecesso . '/'. $mmdecesso . '/'. $aaaadecesso . '</td>';
echo '<td>' . calcola_eta($ggnascita, $mmnascita, $aaaanascita, $ggdecesso, $mmdecesso, $aaaadecesso). '</td>';
echo '<td>' . $localita . '</td>';
echo '<td>' . $settore . '</td>';
echo '<td>' . $numero . '</td>';
echo '<td>' . '<a href="http://palmiano.altervista.org/files/'. $settore . '.pdf'.'". target="_blank">' . 'visualizza'. '</a>'. '</td>';
echo '<td>' . $note . '</td>';
}
?>
</table>
</div>
</html>
Not minding for a moment about all those ifs and query injections (gonna correct later), why doesn't it show what i want to?
Link to page stile.php is correct, i am afraid that is not the right position for <link rel="stylesheet" type="text/css" href="http://sitename.com/stile.php"/>
or that html is too messed up....