I'm making a website for a racing game, and I'd like to have a section of the site where drivers can post tips or tricks for setting up a car. Problem is, sometimes the tips post, sometimes they don't. I've tried LOTS of different combinations ... tip length, special characters, etc ... even holding my mouth in a different position. Have yet to find a pattern.
Here is the code that asks for the info:
<link rel=stylesheet href="tidbits.css" type="text/css">
<link rel=stylesheet href="styles.css" type="text/css">
<table height=500 width=650 cellpadding=0 cellspacing=0 bgcolor="#000000">
<tr>
<td height=500 width=10 cellpadding=0 cellspacing=0>
<table height=500 width=10 cellpadding=0 cellspacing=0>
<tr>
<td height=18 width=10 class="vertend" cellpadding=0 cellspacing=0></td>
</tr>
<tr>
<td height=105 width=10 class="vert" cellpadding=0 cellspacing=0></td>
</tr>
<tr>
<td height=35 width=10 class="vertbeg" cellpadding=0 cellspacing=0></td>
</tr>
<tr>
<td height=342 width=10 cellpadding=0 cellspacing=0></td>
</tr>
</table>
</td>
<td height=500 width=640 cellpadding=0 cellspacing=0>
<table height=500 width=640 cellpadding=0 cellspacing=0>
<tr>
<td width=640 height=18 class="top" cellpadding=0 cellspacing=0></td>
</tr>
<tr>
<td width=640 height=482 cellpadding=0 cellspacing=0 id="main">
<div class="main">
<table width=640 height=482 cellpadding=0 cellspacing=0>
<tr>
<td width=80 height=50 valign=center align=right>
<font face=Tahoma color="#FFFFFF">Topic: <br>Name: <br></font></td>
<td width=560 height=50 valign=center align=left>
<form method="POST" action="subtip.php">
<input type="text" name="topic" size="80"><br>
<input type="text" name="name" size="20">
</td>
</tr>
<tr>
<td width=640 height=382 valign=top align=center colspan=2>
<textarea name="tip" cols="70" rows=20></textarea><br>
<input type="submit" value="Submit"><input type="reset">
</form>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
This saves the data to the database and displays it back to the user:
<?
echo "<html>";
echo "<link rel=stylesheet href=\"tidbits.css\" type=\"text/css\">";
echo "<link rel=stylesheet href=\"styles.css\" type=\"text/css\">";
echo "<body>";
echo "<table height=500 width=650 cellpadding=0 cellspacing=0 bgcolor=\"#000000\">";
echo " <tr>";
echo " <td height=500 width=10 cellpadding=0 cellspacing=0>";
echo " <table height=500 width=10 cellpadding=0 cellspacing=0>";
echo " <tr>";
echo " <td height=18 width=10 class=\"vertend\" cellpadding=0 cellspacing=0></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=105 width=10 class=\"vert\" cellpadding=0 cellspacing=0></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=35 width=10 class=\"vertbeg\" cellpadding=0 cellspacing=0></td>";
echo " </tr>";
echo " <tr>";
echo " <td height=342 width=10 cellpadding=0 cellspacing=0></td>";
echo " </tr>";
echo " </table>";
echo " </td>";
echo " <td height=500 width=640 cellpadding=0 cellspacing=0>";
echo " <table height=500 width=640 cellpadding=0 cellspacing=0>";
echo " <tr>";
echo " <td width=640 height=18 class=\"top\" cellpadding=0 cellspacing=0></td>";
echo " </tr>";
echo " <tr>";
echo " <td width=640 height=482 cellpadding=0 cellspacing=0 id=\"main\" class=\"mainbg\" valign=\"top\">";
echo " <div class=\"main\">";
$username = "username";
$password = "password";
$database = "tips";
$topic = $_POST['topic'];
$name = $_POST['name'];
$tip = $_POST['tip'];
$showtip = nl2br($tip);
if ($topic == "") {
echo "<font face=Verdana color=\"#ffffff\">Please enter a topic.</font>";
} elseif ($name == "") {
echo "<font face=Verdana color=\"#ffffff\">Please enter a name.</font>";
} elseif ($tip == "") {
echo "<font face=Verdana color=\"#ffffff\">Please enter a tip.</font>";
} else {
echo "<font face=Verdana color=\"#dddddd\" size=-1>",$topic,"<br></font>";
echo "<font face=Verdana color=\"#ffffff\" size=-1>",$name,"<br><br></font>";
echo "<font face=Verdana color=\"#dddddd\" size=-1>",$showtip,"<br><br></font>";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "INSERT INTO tips (topic,name,tip) VALUES('$topic','$name','$tip')";
mysql_query($query);
mysql_close();
echo "<font face=Verdana color=\"#ffffff\" size=-1>Thanks for your input.<br><br><a href=\"tips.php\" class=\"menu\">Return to Tips.</a>";
}
echo " </div>";
echo " </td>";
echo " </tr>";
echo " </table>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</body>";
echo "</html>";
?>
I know there are some "cleaner" ways to display html with php, but this is somehow simpler for me to follow. More consistent, I guess. Don't ask, lol, it just works for me.
I'm using PHP5.0.4 and MySQL4.1.12. All row types are 'text'.
any ideas?