I have a problem creating a commentbox in PHP. I've created this commentbox from a simple tutorial and created a database with MySQL and it works fine. The only problem is, the table won't expand when more text than the quantity that can fit on 1 row is send. Instead, the text in the comments just stays on 1 row and breaks through the right column of my website, which looks ridiculous (See the picture in the attachment).
How can I make the comment text in the tabel expand to more rows and keep it within the margins of my page? I'm new at working with PHP, but you can probably see that :P )
Thank you in advance!
<?php
require('connect.php');
$name=$_POST['name'];
$comment=$_POST['comment'];
$submit=$_POST['submit'];
if($submit)
{
if($name&&$comment)
{
$insert=mysql_query("INSERT INTO comment (name,comment) VALUES ('$name', '$comment')");
header("Location: success.php");
}
else
{
echo "Please fill out all the fields.";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<form action="index.php" method="POST">
<table>
<tr><td>Name: </td> <td><input type="text" name="name" /></td> </tr>
<tr><td colspan="2">Comment: </td></tr>
<tr><td colspan="2"><textarea name="comment"></textarea></td></tr>
<tr><td colspan="2"><input type="submit" name="submit" value="comment"/></td></tr>
</table>
</form>
<?php
$getquery=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($getquery))
{
$id=$rows['id'];
$name=$rows['name'];
$comment=$rows['comment'];
$linkdel="<a href=\"delete.php?id=" . $rows['$id'] . "\">Delete user</a>";
echo '<font color="blue">Naam: </font>' . $name . '<br />' . '<br />' . $comment . '<br />' . $dellink . '<br />' . '<hr align="center" size="1px" width="100%" color="black" />';
}
?>
</body>
</html>