?>
<form id='myform' action="<?php echo $_SERVER['PHP_SELF']; ?>" method = 'POST'>
<?php
echo"<center>";
?>
<br>
<textarea id="mytextarea" style="font-size: 12pt" name="post" rows="5" cols="25">
</textarea>
<br>
<?php
echo'<input type="hidden" id="custId" name="number" value='.$topic_number.'>';
?>
<input type="submit" name='action_send' value="Submit" style=" font-size:20px; height:90px; width:150px">
</form>
<?php
echo"</center>";
if( isset ($_POST['action_send'] ) )
{ // add one post
echo"<center>";
$topic_number=test_input($_POST["number"]);
$post=test_input($_POST["post"]);
mysqli_set_charset($ccoonn, "utf8");
$sql = "INSERT INTO `posts` (`post`,`topic`) VALUES ( '$post','$topic_number')";
$result = mysqli_query($ccoonn ,$sql);
echo"<a href='http://saalek110.is-great.net/forum/topic.php?number=$topic_number'>"."return to topic"."</a>";
echo"</center>";
} // end of action_send
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
$topic_number=htmlspecialchars($_GET["number"]);
$topic_number=test_input($_GET["number"]);
if ( isset( $_SESSION["username"] ) )
{
$user=$_SESSION["username"];
}
$sql = "INSERT INTO `posts` (`post`,`topic`,`user`) VALUES ( '$post','$topic_number','$user')";
$topic_number=test_input($_GET["number"]);
if ( isset($topic_number))
{
echo $topic_number;
mysqli_set_charset($ccoonn, "utf8");
$sql = "SELECT * FROM posts WHERE topic=$topic_number";
$result = mysqli_query($ccoonn ,$sql);
echo"<center>";
echo"<table border=1>";
while($info = mysqli_fetch_array( $result ))
{
echo"<tr>";
$post=$info['post'];
$user=$info['user'];
echo"<td>";
echo"<div id='post'>";
echo $post;
echo"</div>";
echo"</td>";
echo"<td>";
echo"<div id='post'>";
echo $user;
echo"</div>";
echo"</td>";
echo"</tr>";
}
echo"</table>";
echo"</center>";
} // if topic_number
$sql = "INSERT INTO `posts` (`post`,`topic`,`user`) VALUES ( '$post','$topic_number','$user')";
$tarikh=$the_date.$the_week.$hour;
$sql = "INSERT INTO `posts` (`post`,`topic`,`user`,`post_date`) VALUES ( '$post','$topic_number','$user','$tarikh')";
$hour= jdate('g:i A');
$the_week=jdate('l');
$the_date=jdate('Y/m/d ');
#date {
border:1px solid #eeff22;
border-radius:5px;
font-size:18px;
width:150px;
padding:2px;
margin-left:20px;
margin-right:20px;
background-color:rgba(250,130,30,1);
}
while($info = mysqli_fetch_array( $result ))
{
echo"<tr>";
$post=$info['post'];
$user=$info['user'];
$post_date=$info['post_date'];
echo"<td>";
echo"<div id='post'>";
echo $post;
echo"<div id='date'>"; // div inside div
echo $post_date;
echo"</div>";
echo"</div>";
echo"</td>";