예제 #1
0
 public function Insert()
 {
     global $obj, $model;
     include_once 'Model/newscomments.php';
     $model = new Newscomments();
     if (isset($_POST['btnSubmit'])) {
         foreach ($_POST as $key => $value) {
             try {
                 $model->{$key} = $value;
             } catch (Exception $ex) {
             }
         }
         if ($model->Insert()) {
             print '<span class="success">Newscomments Created</span>';
             $model = new Newscomments();
         } else {
             print '<span class="error">' . $model->Error . '</span>';
         }
     }
     include_once 'View/Newscomments/insert.php';
 }
예제 #2
0
파일: singleNews.php 프로젝트: csebubt/news
    <p><span>0 like</span> <span> 0 Comments</span></p>
    
    
    <?php 
include_once "Model/user.php";
$usr = new User();
$usr->Id = $_SESSION['userid'];
$usr->SelectById();
include_once "Model/newscomments.php";
$nwc = new Newscomments();
if (isset($_POST['btnComments'])) {
    $nwc->NewsId = $model->Id;
    $nwc->UserId = $_SESSION['userid'];
    $nwc->Comments = $_POST['comments'];
    $nwc->Date = date('Y-m-d');
    if ($nwc->Insert()) {
        $nwc = new Newscomments();
    }
}
?>
    <div class="user_pic"><?php 
print '<img width="80" src="' . baseurl . 'images/user_images/' . $usr->Id . $usr->Image . '" />';
?>
</div>
    <div class="comment_box">
      <form method="post" action="">
        <textarea placeholder="Give your comments" rows="6" cols="80" name="comments" id="comment_input"><?php 
print $nwc->Comments;
?>
</textarea>
        <input type="submit" name="btnComments" value="submit"  />