forse il testo non va a capo perchè la tabella è contenuta nel div, e il div si allarga all'infinito?
scusate posto tutto il div, il codice ha uno stile css:
Codice PHP:
<div class="col_2">
<?php
if ( empty( $_SESSION['username'] ) ) {
?>
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td>[b]Questa pagina necessita del login per essere visualizzata[/b]</td>
</tr>
</table>
<form action="checkuser.php" method="post" name="form1">
<table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td width="22%">Username</td>
<td width="78%"><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
[url="viewguestbook.php"]visualizza la guestbook[/url]
<?
} else {
$prendi = 10; // intervallo
if(isset($_GET['p'])){
$PAGE=$_GET['p']; // pagina corrente
if($PAGE<1){
//$PAGE=1;
}
}
else
$PAGE=1;
$start = ($PAGE*$prendi)-$prendi; /* record da cui iniziare ad estrarre */
//mostro la guestbook
$sql="SELECT * FROM guestbook ORDER BY id DESC LIMIT $start,$prendi";
$result=mysql_query($sql);
echo '<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="">';
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td width="300"><? echo $rows['name']; ?> il <? echo $rows['datetime']; ?> ha scritto: <ul><? echo $rows['comment']; ?>[/list]</td>
</tr>
<?
}
if(mysql_num_rows($result)==0){
?>
<tr>
<td>nessun commento!</td>
</tr>
<?php
}
echo '</table>';
if($PAGE==1){
$succ=$PAGE+1;
echo "pagina precedente |"." pag.$PAGE "."| <a href=\"?p=$succ\">pagina successiva|</a>";
}
if($PAGE>1){
$prec=$PAGE-1;
$succ=$PAGE+1;
echo "<a href=\"?p=$prec\">pagina precedente</a> |"." pag.$PAGE "."| <a href=\"?p=$succ\">pagina successiva|</a>";
}
?>
<table width="400" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td>[b]Firma il Guestbook[/b]</td>
</tr>
</table>
<table width="400" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="">
<tr>
<form id="form1" name="form1" method="post" action="addguestbook.php">
<td>
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="">
<tr colspan="3">
<td width="91"><?php echo $_SESSION['username'];?></td>
</tr>
<tr>
<td>Email:</td>
<td width="286"><input name="email" type="text" id="email" size="40" /></td>
</tr>
<tr>
<td valign="top">Commento:</td>
<td><textarea name="comment" cols="40" rows="3" id="comment"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Invia" />
<input type="reset" name="Submit2" value="Cancella" /></td>
<td width="1"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
}
mysql_close($connection);
?>
</div>
layout.css
codice:
.site_center {text-align:center;}
.main {margin:0 auto; width:780px; text-align:left;}
.col_1, .col_2, .col_3, .col_box_1, .col_box_2, .col_box_3{ float:left;}
#page1 .content .col_1{width:409px;}
#page1 .content .col_2{width:267px;}
/*=========================*/
#page2 .content .col_1{width:438px;}
#page2 .content .col_2{width:232px;}
/*=========================*/
#page3 .content .col_1{width:196px;}
#page3 .content .col_2{width:410px; margin:0 0 0 71px;}
/*=========================*/
#page4 .content .col_1{width:690px;}
/*=========================*/
#page5 .content .col_1{width:196px;}
#page5 .content .col_2{width:410px; margin:0 0 0 71px;}
/*=========================*/
#page6 .content .col_1{width:196px;}
#page6 .content .col_2{width:410px; margin:0 0 0 71px;}
/*=========================*/
#page7 .content .col_1{width:677px;}
/*=========================*/