Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Wyswietlanie textu o rozmiarze czcionki pobranej z formy
qubert
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 11.04.2012

Ostrzeżenie: (0%)
-----


Witam wszytskich forumowiczow!

Jest to moj 1 post a przygode z PHP zaczelem w styczniu takze wybaczcie jesli jest to blachy problem.

Na zadanie domowe musze zrobic 2 strony na pierwszej wybieram miesiac, rozmiar czcionki i ilosc zapytan do bazy. Czyli droga zwraca np:"pokaz" 2 zamowienia z lutego czcionka 2.

Do momentu wyswietlania z bazy wszystko dziala. Zmienna $font posiada wartosc z formularza ale nie wiem jak to pokazac loopie while.

Ponizej jest moj kod - ale chyba print screen najlepiej pokazuje o co chodzi.

CODE
<?php

mysql_connect("127.0.0.1", "root", "") or die("Could not connect : " . mysql_error());
mysql_select_db("orders") or die("Could not select database");


$month = $_GET['month']; //-- month passed from previous page
$font = $_GET['font']; //-- font passed from previous page
$order = $_GET['order']; //-- number of orders passed from previous page
$i = 0; //-- loop counter


//--converting names to numbers

$num = $month;

switch ($num){
case 'January': $num = 01; break;
case 'February': $num = 02; break;
case 'March': $num = 03; break;
case 'April': $num = 04; break;
case 'May': $num = 05; break;
case 'June': $num = 06; break;
case 'July': $num = 07; break;
case 'August': $num = 8; break;
case 'September': $num = 9; break;
case 'October': $num = 10; break;
case 'November': $num = 11; break;
case 'December': $num = 12; break;
}

//--connecting mysql join 2 table results
$query = "select * from orders o join customer c on o.customer_id = c.customer_id where month(order_date)='$num'";
$result = mysql_query($query) or die("Query Error ".mysql_error());

//echo $query;

?>


<head>
<meta charset="utf-8" />
<title>WebFund</title>
<meta name="A1" content="Assignment1" />
</head>
<body>

<!-- Printing table -->
<table width="400" border="0">
<tr>
<td><font size="<?php print $font;?>">Month:</td>
<td><font size="<?php print $font;?>"></td>
<td><font size="<?php print $font;?>"> </td>
<td><font size="<?php print $font;?>"> </td>
</tr>
<tr>
<td><font size="<?php print $font;?>">Order_id</td>
<td><font size="<?php print $font;?>">Customer</td>
<td><font size="<?php print $font;?>">Order_date</td>
<td><font size="<?php print $font;?>">Order_item</td>
</tr>

<?php
//error_reporting(E_ALL);

/*
<font size="<?php print $font;?>"> - from above didn't work also tried i.e.
print '<tr><td><font size="<?php print $font;?>">'.$record[order_id].'</td>';
*/


while ($i<$order){
$record = mysql_fetch_array($result, MYSQL_ASSOC);

print '<tr><td><style= font-size:'.$font.'>'.$record[order_id].'</td>';
print '<td><style= font-size:'.$font.'>'.$record[firstname].$record[surname].'</td>';
print '<td><style= font-size:'.$font.'>'.$record[order_date].'</td>';
print '<td><style= font-size:'.$font.'>'.$record[order_item].'</td></tr></style>';
$i++;
}
echo 'value of font is '.$font; //--shows $font value is correct

?>

</table>
</font>

</body>
</html>




Ten post edytował qubert 11.04.2012, 12:51:25
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 21:17