Show Success Message After form submit in wordpress dashboard - wordpress

How Show Success Message After form submit in word press dashboard?
This code is used for mail sending in word press dashboard.Mail is successfully sending but i need to show success message after sending a mail
please help..My code is
<div class="modal fade" id="myModal<?php echo $val->id; ?>" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Reply to <?php echo $val->mail; ?></h4>
</div>
<div class="modal-body">
<form method="POST" action="" >
<textarea style=" width: 100%; height: 155px;" name="message_content"></textarea>
<input type="hidden" name="message_id" value="<?php echo $val->id; ?>" >
<input type="hidden" name="mail_to" value="<?php echo $val->mail; ?>" >
</div>
<div class="modal-footer">
<button type="submit" name="send_mail" class="btn btn-default">Send</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</form>
<?php
if(isset($_POST['send_mail'])){
$headers=array('Content-Type: text/html; charset=UTF-8');
$message=$_POST['message_content'];
$id=$_POST['message_id'];
$mail_to=$_POST['mail_to'];
echo "$message";
$message_info = wp_mail($mail_to, "hai", $message, $headers);
}
}
?>
</div>
</div>
</div>
</div>

have you tried like
if($message_info ){
echo 'Email sent successfully';
}
this will display notification if the mail is successfully sent

Related

Shortcode not working on product page

I'm making a plugin and I don't understand why my shortcode doesn't work if I insert into a woocommerce product page.
It does work if I add it elsewhere on another page, just not on product pages.
The shortcode is added very simply:
add_shortcode('testing', 'testingform');
function testingform() {
ob_start();
echo 'Width:<br>
<input type="text" name="width" id="width"><br>
Height:<br>
<input type="text" name="height" id="height"><br>
Scale:<br>
<input type="text" name="scale" id="scale"><br><br>
<input type="submit" name="submit" id="submitbtn"><br>
<button type="button" id="stripbtn">Show Strips</button>
<div class="wallpapercontainer">
<div class="holder">
<div class="wallpaper">
</div>
</div>
<div class="heightbar"></div>
<div class="widthbar"></div>
</div>';
$output = ob_get_contents();
ob_end_clean();
return $output;
}

Bootstrap input box - mobile vs tablet/desktop

I'm writing a wordpress theme using Bootstrap for a website. The search input on the navbar looks fine on a desktop/tablet, if the window is resized however to the size of a mobile. The input box and the search button are no longer on inline. Any ideas please?
http://breakingborderline.co.uk/
Navbar
<nav class="navbar navbar-default navbar-color">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand title" href="http://www.breakingborderline.co.uk">Breaking Borderline</a>
</div>
<div class="navbar navbar-right">
<?php get_search_form(); ?>
</div>
</div>
</nav>
Search form
<div class="form-group">
<form role="search" method="get" class="form-inline" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="search" class="form-control form-control-sm" placeholder="Search for..." value="<?php echo esc_attr( get_search_query() ); ?>" name="s" title="Search for:">
<input type="submit" class="btn btn-default" value="Search">
</form>
</div>
Thanks
.form-control are block level elements for smaller devices.
You can make them inline using:
.form-inline .form-control {
display: inline-block;
/* Add vertical-align to align them */
vertical-align: bottom;
}
<form role="search" method="get" class="form-inline" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="search" class="form-control form-control-sm" placeholder="Search for..." value="<?php echo esc_attr( get_search_query() ); ?>" name="s" title="Search for:">
<input type="submit" class="btn btn-default" value="Search">
</form>

load iframe before page load

My php page took longer to load, I have a popup on click of some content in that page.
When I click the content the iframe in popup needs to be opened in popup, the popup opens instantly, but the iframe within the popup didn't open till the page finishes loading.
And while that time the popup is visible but blank;
How to open the iframe before loading finishes?
My code is something like this:
<a style="cursor:pointer" <?php
if (isset($_SESSION['u_id']) && $_SESSION['u_id'] > 0) {
?> href="redirect.php; ?>" <?php
} else {
?> href="iframesignin.php?signpopup=<?php
$encd = 'slr' . $fbanr['s_id'];
echo base64_encode($encd);
?>&id=<?php
echo $fbanr['s_id'];
?>&type=slr&mypage=<?php
echo $fullurl;
?>" data-featherlight="iframe" <?php
}
?> target="_blank" >
GO TO STORE</a>
Here the popup appears through data-featherlight="iframe"
use include/require function intead of iframe
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
<iframe src="testing1.php" width="200" height="200"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
I hope this will help you

Press enter to send message to chat

i got a template site when i bought a package and it has a built in chat function, however you need to press a "send" button each time to send chat messages, this is the script used, i guess it is kinda easy to do it but in not good at scripting :/
<div class="col-lg-4 border-left affix-items scrollbar" id="room-items">
<div id="dropboxy">
<?php
?>
</div>
</div>
<div class="col-lg-6 affix-players" style="padding:10px;">
<div id="playersdropboxy">
<?php include_once("players.php"); ?>
</div>
<div id="affix-players" class="scrollbar">
<div id="rooms"></div> </div> </div> <div class="col-lg-5 affix-right">
<div class="col-xs-24 chat"> <div class="row chat-container">
<div class="row chat-buttons"> <div class="col-xs-24"> <div class="media-body"> <div class="input-group">
<input type="text" class="form-control chat-message" id="text-massage" style="margin-left:6px;" maxlength="300"> <span class="input-group-btn">
<?php if(isset($_SESSION['steamid'])) { ?>
<button class="btn btn-primary" type="submit" data-loading-text="<i class='fa fa-spinner fa-spin'></i> WAIT..." id="send_massage" style="margin-right:6px;">SEND</button>
<div class="sml-bnt" id="smile"></div>
<? }
else { ?>
<form method="get" action="index.php"><input type="hidden" name="login" value=""/><input type="submit" class="btn btn-primary" value="Log in to chat" style="margin-right:6px;"/></form>
<?php }
?>
</span> </div> </div> </div> </div>
<div class="col-xs-24 messages messages-img" style="width:250px;">
<?php if(isadmin($_SESSION['steamid'])){
echo'Admin tools: [clear chat], [turn '. (chaton() ? 'off' : 'on').']';
} ?>
<? include ('mini-chat.php'); ?>
</div> </div>
</div>
<div id="raffle"><div class="col-xs-24 raffle"> <div class="cont"> <div class="circle"> <img id="raffle-img"> </div> <h4 class="name" id="raffle-name"></h4>
<h4 id="countdown-raffle-timer" data-countdown="2020-08-08"></h4>
<a class="btn btn-default" href="?login">LOG IN</a> </div> </div> </div> </div> </div>
Try change method="get" to method="post"

CodeIgniter Bootstrap form-horizontal in modal in not working

My web application uses CodeIgniter framework and Bootstrap 3.0 and I am trying to display a form in my modal. I would like the labels to be on the same line as the input fields but adding form-horizontal to form or modal-body didn't seem to help.
Code segment below:-
<!-- Add Customer Modal -->
<div class="modal fade" id="addCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Add Customer</h4>
</div>
<div class="modal-body">
<?php echo form_open('customer_data/add_customer', ['class'=>'form-horizontal']); ?>
<?php echo form_label('Name: ', 'name'); ?>
<?php echo form_input(['name'=>'name', 'id'=>'name', 'class'=>'form-control']); ?>
<?php echo form_label('Mobile: ', 'mobileNum'); ?>
<?php echo form_input(['name'=>'mobileNum', 'id'=>'mobileNum', 'class'=>'form-control']); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-warning">Add Customer</button>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
I think you missed some function
<?php echo form_close(); ?>
or try this:
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#addCustomer">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="addCustomer" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<!--form horizontal-->
<?php echo form_open('customer_data/add_customer', array('class'=>'form-horizontal')); ?>
<?php echo form_label('Name: ', 'name'); ?>
<?php echo form_input(array('name'=>'name', 'id'=>'name', 'class'=>'form-control')); ?>
<?php echo form_label('Mobile: ', 'mobileNum'); ?>
<?php echo form_input(array('name'=>'mobileNum', 'id'=>'mobileNum', 'class'=>'form-control')); ?>
<?php echo form_close();?>
<!--end form-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

Resources