php - Programming error in sending message template
Get the solution ↓↓↓can some one help me to solve this error? I have this Template, this template its for wordpress It's connected to the WordPress page all time its shown (Page error Please try again to message the member) someone said to me the error in this line (
<?php
if(empty($_SESSION['authorid'])){
echo '<div class="warn">Page error Please try again to message the member </div>';
}else{ ?>
)
this the Template:
<?php /* Template Name: Template send a message*/ ?>
<?php get_header(); ?>
<?php
$sendto=$_SESSION['authorid'];
$sender=get_current_user_id();
$user_meta=get_userdata($sendto);
?>
<div class="container pagecon clearfix ">
<div class="singleright col-lg-8 col-xs-12 pull-left"><!--start single right area-->
<div class="lefpage">
<div class="sendtext">
Send a private message to the member :<?php echo $user_meta-> user_login; ?>
</div>
<?php
if(isset($_POST['sendmessage'])){
if(empty($_SESSION['authorid'])){
echo '<div class="warn"> The message has already been sent</div>';
}else{
$sender=get_current_user_id();
$receiver=$_SESSION["authorid"];
$title=clean_text($_POST['title']);
$content=clean_text($_POST['content']);
$mainmessage=clean_text($_POST['mainmessage']);
if(empty($title) || empty($content)){
echo '<div class="warn">You must enter the message title and message content to complete sending</div>';
} else {
$new_post = array(
'post_title' => $title,
'post_status' => 'publish',
'post_type' => 'messages' ,
'post_content' => $content
);
$thesender = wp_insert_post($new_post);
if($thesender !=0 ){
update_post_meta( $thesender, 'sender',$sender);
update_post_meta( $thesender, 'receiver',$receiver);
update_post_meta( $thesender, 'checkmessageread','0');
update_post_meta( $thesender, 'deletefromsender','0');
update_post_meta( $thesender, 'deletefromreceiver','0');
if(!empty($mainmessage)){
update_post_meta( $thesender, 'mainmessage',$mainmessage);
}else {
update_post_meta( $thesender, 'mainmessage','0');
}
echo '<div class="success">The message has been sent successfully</div>';
unset($_SESSION['authorid']);
}
}
}
}else{
?>
<?php
if(empty($_SESSION['authorid'])){
echo '<div class="warn">Page error Please try again to message the member </div>';
}else{ ?>
<form class="form-horizontal" action="#" method="post">
<div class="form-group">
<div class="col-sm-12">
<input type="text" name="title" class="form-control" id="input0" placeholder="Message title">
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<textarea class="form-control" rows="5" name="content" id="input1" placeholder="Message content"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 ">
<input type="submit" name="sendmessage" class="btn btn-success " value="send a message">
</div>
</div>
</form>
<?php }} ?>
</div>
</div><!--end single right area-->
<div class="singleleft col-lg-4 col-xs-12 pull-right"><!--start single left area-->
<?php require_once(TEMPLATEPATH . '/usersidemenu.php'); ?>
</div><!--end single left area-->
</div><!--end of pagecontainer--->
<?php get_footer();?>
and this is the start session
function register_my_session()
{
if( !session_id() )
{
session_start();
}
}
add_action("init", "register_my_session");
what is the issue? and what I can do? thanks for help.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illuminate\http\exceptions\posttoolargeexception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.