juniorx
05-02-2004, 12:59 PM
Hello,
im currently designing a website where the user, once registered can post his or her news on the front page. To accomplish this i made a text area where it will store the string in a php variable named $news once the user hit submits. Heres my problem.
For testing purposes i just hit the letter T until two rows of t's are made in the text area. The problem is, on the table where i display the message(which is the same size as the textarea) it only dispalys one row(it will combine the two rows of T's by readjusting the table.
So basically what i want to have happen is the structure the user has in the text area should be maintained when it is displayed simular to how these forums work.
---------------------------------
1.Evaluating the text area and textboxes
$nt=$_POST['newstopic'];
$ng=$_POST['newsgame'];
$nm=$_POST['newsmessage'];
$nd=date("l F dS Y h:i a");
$na=$_SESSION['userwhoposted'];
mysql_query("INSERT INTO newstories (topic,message,author,date,gametype) VALUES ('$nt','$nm','$na','$nd','$ng')");
echo"<font color=\"white\">News sucessfully updated<br></font><br>";
-----------------------------------
2.Display code
$query = "SELECT * FROM newstories order by id DESC LIMIT 10";
$result = mysql_query($query,$db);
echo "<TABLE style=\"table-layout:fixed\" style=\"color:white\" border=\"0\" cellspacing=\"0\" width=\"100%\">";
while($r=mysql_fetch_array($result))
{
echo "<TR>";
echo"<TD width=\"100%\">";
echo "<table style=\"color: white\" border=\"1\" bordercolor=\"#00ffff\" cellspacing=\"0\" width=\"100%\">";
echo"<tr>";
echo"<td BGCOLOR=\"#0096B8\" ><font color=white>Subject:</font></td>";
echo"<td BGCOLOR=\"#0096B8\" background=\"/images/blgr016.jpg\">";
echo"<b>$r[topic]</b>";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td width=\"30%\"valign=top>$r[author]<br>";
echo"</td>";
echo"<td>";
$stringb=$r['message'];
echo"$stringb";
echo"<br>Submitted:".$r['date']."</td></tr></table>";
echo"</td></tr>";//end of one news item
}
-----------------------------------------
im currently designing a website where the user, once registered can post his or her news on the front page. To accomplish this i made a text area where it will store the string in a php variable named $news once the user hit submits. Heres my problem.
For testing purposes i just hit the letter T until two rows of t's are made in the text area. The problem is, on the table where i display the message(which is the same size as the textarea) it only dispalys one row(it will combine the two rows of T's by readjusting the table.
So basically what i want to have happen is the structure the user has in the text area should be maintained when it is displayed simular to how these forums work.
---------------------------------
1.Evaluating the text area and textboxes
$nt=$_POST['newstopic'];
$ng=$_POST['newsgame'];
$nm=$_POST['newsmessage'];
$nd=date("l F dS Y h:i a");
$na=$_SESSION['userwhoposted'];
mysql_query("INSERT INTO newstories (topic,message,author,date,gametype) VALUES ('$nt','$nm','$na','$nd','$ng')");
echo"<font color=\"white\">News sucessfully updated<br></font><br>";
-----------------------------------
2.Display code
$query = "SELECT * FROM newstories order by id DESC LIMIT 10";
$result = mysql_query($query,$db);
echo "<TABLE style=\"table-layout:fixed\" style=\"color:white\" border=\"0\" cellspacing=\"0\" width=\"100%\">";
while($r=mysql_fetch_array($result))
{
echo "<TR>";
echo"<TD width=\"100%\">";
echo "<table style=\"color: white\" border=\"1\" bordercolor=\"#00ffff\" cellspacing=\"0\" width=\"100%\">";
echo"<tr>";
echo"<td BGCOLOR=\"#0096B8\" ><font color=white>Subject:</font></td>";
echo"<td BGCOLOR=\"#0096B8\" background=\"/images/blgr016.jpg\">";
echo"<b>$r[topic]</b>";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td width=\"30%\"valign=top>$r[author]<br>";
echo"</td>";
echo"<td>";
$stringb=$r['message'];
echo"$stringb";
echo"<br>Submitted:".$r['date']."</td></tr></table>";
echo"</td></tr>";//end of one news item
}
-----------------------------------------