passing a unique variable inbetween url - javascript

i have a software which passed a unique id to the url of my clients but limitation of my software is that is passes the unique id in the end of the url and sometimes link are too long and we want to pass id inbetween the url like www.zyx.com?id=i want to pass id here in between &jsabdkhbdf&sdkjbahdb&kjdsbkfbskdb&pid=jdndhf
i have seeen a software where is you to pass id in between you type like this ?id=[%id%] where every in url i type this parameter will pass there idk how its hapenning there pls help pasting the code
<?php require_once("session.php" );?>
<?php include("header.php"); require_once("dbcon.php");?>
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<li class="sidebar-search">
<div class="input-group custom-search-form">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</li>
<li>
<i class="fa fa-dashboard fa-fw"></i> Dashboard<br>
</li>
<li>
<i class="fa fa-bar-chart-o fa-fw"></i> Survey<span class="fa arrow"></span>
<ul class="nav nav-second-level">
<li>
New Survey
Add Clients
Clients List
</li>
<li>
Survey List
</li>
</ul>
<!-- /.nav-second-level -->
</li><br>
<li>
<i class="fa fa-table fa-fw"></i>Add Vendor
Vendor List
</li>
<li>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- /.sidebar-collapse -->
</div>
<!-- /.navbar-static-side -->
<nav>
<div id="page-wrapper">
<div class="row">
<div class="col-lg-8 ">
<h1 class="page-header">Dashboard</h1>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-check-circle fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'open%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Surveys Completed</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-green">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-tasks fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<div class="huge">New</div>
<div>Survey</div>
</div>
</div>
</div>
<a href="new_survey.php">
<div class="panel-footer">
<span class="pull-left">Create New Survey</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-yellow">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-ban fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'close%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>InCompleted Surveys</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
<div class="col-lg-3 col-md-6">
<div class="panel panel-red">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3">
<i class="fa fa-support fa-5x"></i>
</div>
<div class="col-xs-9 text-right">
<?php
$sql = "SELECT COUNT(status) as count from new_survey WHERE Status LIKE 'invoice%'";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() )
echo "<div class='huge'>{$rows['count']}</div>";
?>
<div>Invoiced Surveys</div>
</div>
</div>
</div>
<a href="#">
<div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</a>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
Survey List
</div>
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" width="100%" border="1">
<thead><tr>
<th>Survey ID</th>
<th>Client Name</th>
<th>Survey Name</th>
<th>Client Live URL</th>
<th>Client Test URL</th>
<th>Completed</th>
<th>InCompleted</th>
<th>Quota Full</th>
<th>Time Period</th>
<th>Creation Date</th>
<th>End Date</th>
<th>Status</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<?php
**this is unique parameter**
**$a = bin2hex(random_bytes(10));**
$sql = "SELECT * from new_survey where survey_id order by survey_id desc";
$result = $conn->query($sql);
while($rows = $result->fetch_assoc() ){
echo "<tr>";
echo " <td>{$rows['survey_id']}</td>";
echo " <td>{$rows['client_name']}</td>";
echo "<td>{$rows['survey_name']}</td>";
here it is passing when fetching the url from database onclick of link
**echo "<td> <a href=". $rows['client_live_url'] . urlencode($a) . "&s_id=" . $rows['survey_id'] . " target='_blank'> Click Here </a></td>";**
echo "<td> Click Here </td>";
echo" <td>{$rows['completed']}</td>";
echo "<td>{$rows['incompleted']}</td>";
echo "<td>{$rows['quota_full']}</td>";
echo" <td>{$rows['time_period']}</td>";
echo" <td>{$rows['creation_date']}</td>";
echo" <td>{$rows['end_date']}</td>";
echo" <td>{$rows['status']}</td>";
echo" <td><a href=\"edit_survey.php?id={$rows['survey_id']}\">Edit</td>";
echo "</tr>";
}
$conn->close();
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /#page-wrapper -->
<div class="panel-footer">
<div class="text-center">
<?php echo date('Y'); ?>, ©
<?php echo "$copyright"; ?>
</div>
</div>
<!-- /#wrapper -->
<!-- jQuery -->
<script src="./vendor/jquery/jquery.min.js"></script>
<!-- Bootstrap Core JavaScript -->
<script src="./vendor/bootstrap/js/bootstrap.min.js"></script>
<!-- Metis Menu Plugin JavaScript -->
<script src="./vendor/metisMenu/metisMenu.min.js"></script>
<!-- Morris Charts JavaScript -->
<script src="./vendor/raphael/raphael.min.js"></script>
<script src="./vendor/morrisjs/morris.min.js"></script>
<script src="./data/morris-data.js"></script>
<!-- Custom Theme JavaScript -->
<script src="./dist/js/sb-admin-2.js"></script>

Related

Dynamically split div columns

code i have written below is working fine but at the end of the looping the div is not closed its still opening a loop
<div class="carousel-inner">
<div class="item active">
<div class="row">
<?php
$recent_projects_sql="SELECT * from recent_projects where service_type='upholstery'";
$recent_projects_conn=mysql_query($recent_projects_sql) or die(mysql_error());
$i=0; $split=0;
while($projects=mysql_fetch_array($recent_projects_conn)) {
$i++;
?>
<div class="col-sm-3">
<div class="col-item" style="">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/<?php echo $projects['attachment1']; ?>" alt="User one">
</div>
<div class="info">
<div class="name">
<?php echo $projects['service_name']; ?>
</div>
<div class="degination">
<?php echo $projects['sub_title']; ?>
</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<?php
$split++;
if ($split % 4 == 0){
echo '</div></div><div class="item"><div class="row">';
}
}
?>
</div>
</div>
</div>
The Div has splited very well but in end of the loop div has not been closed. Thats only the problem please provide me the help to sort out the problem
When I inspect the element the last loop will show at the given result as follows:
<div class="col-sm-3">
<div class="col-item">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/1557301934.jpg" alt="User one">
</div>
<div class="info">
<div class="name">UPHOLSTERY</div>
<div class="degination">UPHOLSTERY</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div></div><div class="item"><div class="row">
I want to remove the two opening div's as dynamically. How can i set this to remove opened div's at then end of the looping
You can do this:
<div class="carousel-inner">
<?php
$recent_projects_sql="SELECT * from recent_projects where service_type='upholstery'";
$recent_projects_conn=mysql_query($recent_projects_sql) or die(mysql_error());
$i=0; $split=0;
while($projects=mysql_fetch_array($recent_projects_conn)) {
$i++;
?>
<div class="item <?php if($i==1) echo "active";?>">
<div class="row">
<div class="col-sm-3">
<div class="col-item" style="">
<div class="photo-shadow"></div>
<div class="photo">
<img src="admin/assets/images/uploads/projects/<?php echo $projects['attachment1']; ?>" alt="User one">
</div>
<div class="info">
<div class="name">
<?php echo $projects['service_name']; ?>
</div>
<div class="degination">
<?php echo $projects['sub_title']; ?>
</div>
<div class="buttons">
<a class="btn btn-theme ripple-effect" href="#">View More</a>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>

why the comment is not displayed?

I need help on this I don't know if it a mistake here because the comment is not displayed, I submit the comment and I see it in the database but it's doesn't show on unfortunately.
popuptweets.php
<?php
include '../init.php';
if (isset($_POST['showpopup']) && !empty($_POST['showpopup'])) {
$tweetID = $_POST['showpopup'];
$user_id = $_SESSION['user_id'];
$tweet = $getFromT->getPopupTweet($tweetID);
$user = $getFromU->userData($user_id);
$likes = $getFromT->likes($user_id, $tweetID);
$retweet = $getFromT->checkRetweet($tweetID, $user_id);
$comments = $getFromT->comments($tweetID);
?>
<div class="tweet-show-popup-wrap">
<input type="checkbox" id="tweet-show-popup-wrap">
<div class="wrap4">
<label for="tweet-show-popup-wrap">
<div class="tweet-show-popup-box-cut">
<i class="fa fa-times" aria-hidden="true"></i>
</div>
</label>
<div class="tweet-show-popup-box">
<div class="tweet-show-popup-inner">
<div class="tweet-show-popup-head">
<div class="tweet-show-popup-head-left">
<div class="tweet-show-popup-img">
<img src="<?php echo BASE_URL.$tweet->profileImage;?>"/>
</div>
<div class="tweet-show-popup-name">
<div class="t-s-p-n">
<a href="<?php echo BASE_URL.$tweet->username;?>">
<?php echo $tweet->screenName;?>
</a>
</div>
<div class="t-s-p-n-b">
<a href="<?php echo BASE_URL.$tweet->username;?>">
#<?php echo $tweet->username;?>
</a>
</div>
</div>
</div>
<div class="tweet-show-popup-head-right">
<button class="f-btn"><i class="fa fa-user-plus"></i> Follow </button>
</div>
</div>
<div class="tweet-show-popup-tweet-wrap">
<div class="tweet-show-popup-tweet">
<?php echo $getFromT->getTweetLinks($tweet->status);?>
</div>
<div class="tweet-show-popup-tweet-ifram">
<?php if(!empty($tweet->tweetImage)){?>
<img src="<?php echo BASE_URL.$tweet->tweetImage;?>"/>
<?php }?>
</div>
</div>
<div class="tweet-show-popup-footer-wrap">
<div class="tweet-show-popup-retweet-like">
<div class="tweet-show-popup-retweet-left">
<div class="tweet-retweet-count-wrap">
<div class="tweet-retweet-count-head">
RETWEET
</div>
<div class="tweet-retweet-count-body">
<?php echo $tweet->retweetCount;?>
</div>
</div>
<div class="tweet-like-count-wrap">
<div class="tweet-like-count-head">
LIKES
</div>
<div class="tweet-like-count-body">
<?php echo $tweet->likesCount;?>
</div>
</div>
</div>
<div class="tweet-show-popup-retweet-right">
</div>
</div>
<div class="tweet-show-popup-time">
<span><?php echo $tweet->postedOn;?></span>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<?php if($getFromU->loggedIn() === true){
echo '<li><i class="fa fa-share" aria-hidden="true"></i></a></button></li>
<li>'.(($tweet->tweetID === $retweet['retweetID']) ? '<button class="retweeted" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><a href="#"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.$tweet->retweetCount.'</span></button>' : '<button class="retweet" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><a href="#"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">'.(($tweet->retweetCount > 0) ? $tweet->retweetCount : '').'</span></button>').'</li>
<li>'.(($likes['likeOn'] === $tweet->tweetID) ? '<button class="unlike-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart-o" aria-hidden="true"></i><span class="likesCounter">'.$tweet->likesCount.'</span></button>' : '<button class="like-btn" data-tweet="'.$tweet->tweetID.'" data-user="'.$tweet->tweetBy.'"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCounter">'.(($tweet->likesCount > 0) ? $tweet->likesCount : '').'</span></button>').'</li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>';
}else{
?>
<li><button type="buttton"><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><button type="button"><i class="fa fa-retweet" aria-hidden="true"></i><span class="retweetsCount">RETWEET-COUNT</span></button></li>
<li><button type="button"><i class="fa fa-heart" aria-hidden="true"></i><span class="likesCount">LIKES-COUNT</span></button></button></li>
<?php }?>
</ul>
</div>
</div>
</div><!--tweet-show-popup-inner end-->
<?php if($getFromU->loggedIn() === true){?>
<div class="tweet-show-popup-footer-input-wrap">
<div class="tweet-show-popup-footer-input-inner">
<div class="tweet-show-popup-footer-input-left">
<img src="<?php echo BASE_URL.$user->profileImage?>"/>
</div>
<div class="tweet-show-popup-footer-input-right">
<input id="commentField" type="text" data-tweet="<?php echo $tweet->tweetID;?>" name="comment" placeholder="Reply to #<?php echo $tweet->username;?>">
</div>
</div>
<div class="tweet-footer">
<div class="t-fo-left">
<ul>
<li>
<label for="t-show-file"><i class="fa fa-camera" aria-hidden="true"></i></label>
<input type="file" id="t-show-file">
</li>
<li class="error-li">
</li>
</ul>
</div>
<div class="t-fo-right">
<span id="count">140</span>
<input type="submit" id="postComment" value="Tweet">
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/comment.js"></script>
</div>
</div>
</div><!--tweet-show-popup-footer-input-wrap end-->
<?php }?>
<div class="tweet-show-popup-comment-wrap">
<div id="comments">
<?php
foreach ((array)$comments as $comment) {
echo '<div class="tweet-show-popup-comment-box">
<div class="tweet-show-popup-comment-inner">
<div class="tweet-show-popup-comment-head">
<div class="tweet-show-popup-comment-head-left">
<div class="tweet-show-popup-comment-img">
<img src="'.BASE_URL.$comment->profileImage.'">
</div>
</div>
<div class="tweet-show-popup-comment-head-right">
<div class="tweet-show-popup-comment-name-box">
<div class="tweet-show-popup-comment-name-box-name">
'.$comment->screenName.'
</div>
<div class="tweet-show-popup-comment-name-box-tname">
#'.$comment->username.' - '.$comment->commentAt.'
</div>
</div>
<div class="tweet-show-popup-comment-right-tweet">
<p>#'.$tweet->username.' '.$comment->comment.'</p>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><i class="fa fa-heart-o" aria-hidden="true"></i></li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--TWEET SHOW POPUP COMMENT inner END-->
</div>
';
}
?>
</div>
</div>
<!--tweet-show-popup-box ends-->
</div>
</div>
<?php
}
?>
comment.js
$(function () {
$(document).on('click', '#postComment', function(){
var comment = $('#commentField').val();
var tweet_id = $('#commentField').data('tweet');
if(comment !=""){
$.post('http://localhost/twitter/core/ajax/comment.php', {comment:comment,tweet_id:tweet_id}, function(data){
$('#comments').html(data);
$('#commentField').val("");
});
}
})
});
commnet.php
<?php
include '../init.php';
if (isset($_POST['comment']) && !empty($_POST['comment'])) {
$comment = $getFromU->checkInput($_POST['comment']);
$user_id = $_SESSION['user_id'];
$tweetID = $_POST['tweet_id'];
if (!empty($comment)) {
$getFromU->create('comments',array('comment' => $comment, 'commentOn' => $tweetID, 'commentBy' => $user_id, 'commentAt' => date('Y-m-d H:i:s')));
$comments = $getFromT->comments($tweetID);
$tweet = $getFromT->getPopupTweet($tweetID);
foreach ((array)$comments as $comment) {
echo '<div class="tweet-show-popup-comment-box">
<div class="tweet-show-popup-comment-inner">
<div class="tweet-show-popup-comment-head">
<div class="tweet-show-popup-comment-head-left">
<div class="tweet-show-popup-comment-img">
<img src="'.BASE_URL.$comment->profileImage.'">
</div>
</div>
<div class="tweet-show-popup-comment-head-right">
<div class="tweet-show-popup-comment-name-box">
<div class="tweet-show-popup-comment-name-box-name">
'.$comment->screenName.'
</div>
<div class="tweet-show-popup-comment-name-box-tname">
#'.$comment->username.' - '.$comment->commentAt.'
</div>
</div>
<div class="tweet-show-popup-comment-right-tweet">
<p>#'.$tweet->username.' '.$comment->comment.'</p>
</div>
<div class="tweet-show-popup-footer-menu">
<ul>
<li><button><i class="fa fa-share" aria-hidden="true"></i></button></li>
<li><i class="fa fa-heart-o" aria-hidden="true"></i></li>
<li>
<i class="fa fa-ellipsis-h" aria-hidden="true"></i>
<ul>
<li><label class="deleteTweet">Delete Tweet</label></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<!--TWEET SHOW POPUP COMMENT inner END-->
</div>
';
}
}
}
?>
Those are all codes I used so how can I solve the problem?
As we have investigated the problem was in missing return

Hide #go_to_top icon when box is clicked

I have this chat box and this go_to_top icon. Is that possible to hide the icon when the box is clicked and open, and display it again when its closed?
This is how it looks in my local host (view extern):
This my ChatBox code
<section class="btn-xs bd-section-5 hidden-xs bd-page-width bd-tagstyles" id="section5" data-section-title="Section">
<div class="bd-container-inner bd-margins clearfix">
<div class=" bd-layoutbox-9 bd-page-width bd-no-margins clearfix">
<div type="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" class="chatbutton bd-container-inner btn btn-default">
<h4 class=" bd-textblock-11 bd-content-element">
<span style="font-weight: normal;">Call us on</span> 0800 0125 888
</h4>
</div>
<div class="panel-collapse collapse" id="collapseOne">
<div class="panel-body">
<ul class="chat">
<li class="left clearfix"><span class="chat-img pull-left">
<img src="./assets/images/<?php echo ($cruise_avatar[0]); ?>.png" alt="<?php echo ($cruise_avatar[0]); ?>" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php echo ($cruise_avatar[1]); ?></strong> <small class="pull-right text-muted">
<span class="glyphicon glyphicon-time"></span><?php echo date("h:i:s A"); ?></small>
</div>
<p>
<?php echo ($cruise_avatar[2]); ?>
</p>
</div>
</li>
<li class="right clearfix"><span class="chat-img pull-right">
<img src="http://placehold.it/50/FA6F57/fff&text=ME" alt="User Avatar" class="img-circle" />
</span>
<div class="chat-body clearfix">
<div class="header">
<small class=" text-muted"><span class="glyphicon glyphicon-time"></span><?php echo date("h:i:s A"); ?></small>
<strong class="pull-right primary-font">Bhaumik Patel</strong>
</div>
<p>
<?php echo ($cruise_avatar[2]); ?>
</p>
</div>
</li>
</ul>
</div>
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" placeholder="Type your message here..." />
<span class="input-group-btn">
<button class="btn btn-warning btn-sm" id="btn-chat">
Send</button>
</span>
</div>
</div>
</div>
</div>
</div>
</section>
And that's it looks like this when clicked (view extern):
I tried to hide it with jQuery like this: UPDATE it to
<script>
$(document).ready(function(){
$(".bd-layoutbox-9").click(function(){
if ($("span.bd-icon-67.bd-icon").css("display","inline-block")){
$("span.bd-icon-67.bd-icon").css("display","none");
}
else if ($("span.bd-icon-67.bd-icon").css("display","none")){
$("span.bd-icon-67.bd-icon").css("display","inline-block");
}
});
});
</script>
and my span code
<div data-smooth-scroll data-animation-time="250" class=" bd-smoothscroll-3">
<span class="bd-icon-67 bd-icon "></span>
</div>
I can hide it when Chatbox is open, but when i close it is not displayed again.

make notification on php and jquery

<!DOCTYPE html>
<html>
<head>
<title><?php echo $title ?></title>
<!--Logo di title bar -->
<link rel="shortcut icon" href="<?php echo base_url();?>asset/img/logokominfo.png"/>
<!--CSS-->
<link rel="stylesheet" href="<?php echo base_url();?>asset/CSS/style-boots.css?<?php echo time(); ?>">
<link rel="stylesheet" href="<?php echo base_url();?>asset/CSS/style-pengumuman.css?<?php echo time(); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style type="text/css">
body {
background: #f7f7f7;
font-family: 'Montserrat', sans-serif;
}
.dropzone {
background: #fff;
border: 2px dashed #ddd;
border-radius: 5px;
}
.dz-message {
color: #999;
}
.dz-message:hover {
color: #464646;
}
.dz-message h3 {
font-size: 200%;
margin-bottom: 15px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../asset/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="../asset/css/style-profile.css?<?php echo time(); ?>">
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
</head>
<body>
<nav id="sticker" class="navbar navbar-inverse">
<div class="container">
<div class="navbar-header">
<a class="menu"><i class="fa fa-bars" id="menu_icon"></i></a>
<a class="navbar-brand" href="#">
<img src="<?php echo base_url();?>asset/img/logo_emagang.png" class="img-responsive" />
</a>
</div><!--navbar-header close-->
<div class="collapse navbar-collapse drop_menu" id="content_details">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<span class="glyphicon glyphicon-user"></span><?php echo $userData['nama_lengkap'] ?><span class="caret"></span>
<ul class="dropdown-menu">
<li><i class="fa fa-user" aria-hidden="true"></i> Profile
<li><i class="fa fa-pencil-square-o" aria-hidden="true"></i> Ubah Profile</li>
<li><i class="fa fa-key" aria-hidden="true"></i> Ubah Password</li>
<li><i class="fa fa-sign-out" aria-hidden="true"></i> Logout
</li>
</ul>
</li>
</ul><!--navbar-right close-->
</div><!--collapse navbar-collapse drop_menu close-->
</div><!--container-fluid close-->
</nav><!--navbar navbar-inverse close-->
<br>
<br>
<section>
<div class="container" style="margin-top: 10px;">
<div class="profile-head">
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12"><br><br><br><br><br><br>
<h6>
<img src="<?php echo base_url();?>uploads/images/<?php echo $userData['nama_foto']."?".time(); ?>">
<br><br><?php echo $userData['nama_lengkap'] ?><br><br>
</h6>
</div><!--col-md-4 col-sm-4 col-xs-12 close-->
<div class="col-md-8 col-sm-5 col-xs-12"><br><br><br><br><br>
<h5><?php echo $userData['nama_lengkap'] ?></h5>
<p>Siswa / Mahasiswa </p>
<ul>
<li><span class="glyphicon glyphicon-info-sign"></span> <?php echo $userData['tanggal_lahir'] ?></li>
<li><span class="glyphicon glyphicon-book"></span> <?php echo $userData['nama_institusi'] ?></li>
<li><span class="glyphicon glyphicon-home"></span> <?php echo $userData['alamat'] ?></li>
<li><span class="glyphicon glyphicon-phone"></span> <?php echo $userData['no_telpon'] ?></li>
<li><span class="glyphicon glyphicon-envelope"></span><?php echo $userData['email'] ?></li>
</ul>
</div><!--col-md-8 col-sm-8 col-xs-12 close-->
</div>
</div><!--profile-head close-->
</div><!--container close-->
<dir class="container">
<?php
// $id = $this->session->flashdata('id');
$salah = $this->session->flashdata('salah');
$berhasil = $this->session->flashdata('berhasil');
?>
<!--error message-->
<?php echo $salah['error'];?>
<?php echo $berhasil;?>
<?php
$status = $userData['status'];
if($status == 'diterima'){
$notif = 'baru';
}
?>
<div class="panel with-nav-tabs panel-primary">
<div class="panel-heading">
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1primary" data-toggle="tab">
<span class="glyphicon glyphicon-user"></span> Personal Data
</a></li>
<li><a href="#tab2primary" data-toggle="tab">
<i class="fa fa-university" aria-hidden="true"></i> Pendidikan
</a></li>
<li><a href="#tab3primary" data-toggle="tab">
<i class="fa fa-file" aria-hidden="true"></i> Daftar Riwayat Hidup
</a></li>
<li>
<a href="#tab4primary" data-toggle="tab">
<span class="badge quote-badge" id="pemberitahuan"><?php echo $notif ?></span>
<i class="fa fa-bullhorn" aria-hidden="true"></i> Pengumuman
</a></li>
</ul>
</div>
<div class="panel-body">
<div class="tab-content">
<div class="tab-pane fade in active" id="tab1primary">
<div class="row">
<div class="col-md-8">
<table class="table table-striped">
<thead>
<tr>
<th>Data Akun</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Email</td>
<td>:</td>
<td>
<?php echo $userData['email'] ?>
</td>
</tr>
<tr>
<td>tanggal daftar</td>
<td>:</td>
<td>
<?php echo $userData['tanggal_daftar'] ?>
</td>
</tr>
</tbody>
<thead>
<tr>
<th>Tujuan Magang</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Satuan kerja</td>
<td>:</td>
<td>
<?php echo $userData['nama_satuan_kerja'] ?>
</td>
</tr>
<tr>
<td>Unit kerja</td>
<td>:</td>
<td>
<?php echo $userData['nama_unit_kerja'] ?>
</td>
</tr>
<tr>
<td>Tanggal Mulai</td>
<td>:</td>
<td>
<?php
$tanggal_mulai = $userData['tanggal_mulai'];
echo date('d F Y', strtotime($tanggal_mulai));
// $input = $userData['tanggal_mulai'];
// $date = strtotime($input);
// $day = date('d',$date);
// $month = date('m',$date);
// $year = date('Y',$date);
// echo $month;
?>
</td>
</tr>
<tr>
<td>Tanggal Selesai</td>
<td>:</td>
<td>
<?php
$tanggal_lahir = $userData['tanggal_selesai'];
echo date('d F Y', strtotime($tanggal_lahir));
?>
</td>
</tr>
</tbody>
<thead>
<tr>
<th>Data Pribadi</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Nama Lengkap</td>
<td>:</td>
<td>
<?php echo $userData['nama_lengkap'] ?>
</td>
</tr>
<tr>
<td>Jenis Kelamin</td>
<td>:</td>
<td>
<?php echo $userData['jenis_kelamin'] ?>
</td>
</tr>
<tr>
<td>Tanggal Lahir</td>
<td>:</td>
<td>
<?php
$tanggal_lahir = $userData['tanggal_lahir'];
echo date('d F Y', strtotime($tanggal_lahir));
?>
</td>
</tr>
<tr>
<td>Alamat</td>
<td>:</td>
<td>
<?php echo $userData['alamat'] ?>
</td>
</tr>
<tr>
<td>No telpon</td>
<td>:</td>
<td>
<?php echo $userData['no_telpon'] ?>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab2primary">
<table class="table table-striped">
<thead>
<tr>
<th>Pendidikan</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>Tingkat Pendidikan</td>
<td>:</td>
<td>
<?php echo $userData['tingkat_pendidikan'] ?>
</td>
</tr>
<tr>
<td>Nama Institusi</td>
<td>:</td>
<td>
<?php echo $userData['nama_institusi'] ?>
</td>
</tr>
<tr>
<td>Jurusan</td>
<td>:</td>
<td>
<?php echo $userData['jurusan'] ?>
</td>
</tr>
<tr>
<td>Nilai Raport Rata-Rata/ IPK</td>
<td>:</td>
<td>
<?php echo $userData['nilai'] ?>
</td>
</tr>
<tr>
<td>Alamat Institusi</td>
<td>:</td>
<td>
<?php echo $userData['alamat_institusi'] ?>
</td>
</tr>
<tr>
<td>No telpon Institusi</td>
<td>:</td>
<td>
<?php echo $userData['no_telpon_institusi'] ?>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tab-pane fade" id="tab3primary">
<div class="row">
<div class="col-md-4">
<div class="alert alert-warning alert-dismissable fade in">
×
<strong>catatan :</strong> Untuk melihat CV langsung diprofile disarankan untuk menonaktifkan software bantuan download, seperti: IDM Dll.
</div>
<div class="bs-calltoaction bs-calltoaction-primary">
<div class="row">
<div class="col-md-12">
<p>Daftar Riwayat Hidup</p>
<div class="cta-button">
<span class="glyphicon glyphicon-download-alt"></span> Donwload daftar riwayat hidup
</div>
<p style="font-size: 12px">Terakhir Di Update : <?php
$tanggal_update_cv = $userData['tanggal_update_cv'];
echo date('d F Y', strtotime($tanggal_update_cv)); ?></p>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<center>
<h4 class="name">Ubah CV / Daftar Riwayat Hidup</h4>
<hr class="whitehr">
</center>
<div id="content">
<div class="row">
<div class="col-md-7"><br>
<div class="dropzone">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<center><br><br><br><br>
<h3>Upload file disini</h3> ukuran <strong>maksimal</strong> 2MB
<?php echo form_open_multipart('users/updatecv');?>
<input type="hidden" id="id" name="id" value="<?php echo $userData['id'] ?>">
<input type="hidden" id="nama_cv" name="nama_cv" value="<?php echo $userData['nama_cv'] ?>">
<input type="file" style="margin-left : 50px" name="document" id="files" accept=".doc, .docx, application/msword, application/pdf" required>
<button style="margin-top : 20px" type="submit" value="Upload" name="submit" class="btn btn-primary btn-lg">
<i class="fa fa-upload" aria-hidden="true"></i>
upload
</button>
<?php echo form_close();?>
</center><br><br><br><br>
</div>
</div>
</div>
</div>
<div class="col-md-5">
Contoh CV(Daftar Riwayat Hidup)
<a href="<?php echo base_url();?>asset/doc/contoh_cv.doc">
<img src="<?php echo base_url();?>asset/doc/contoh_cv.png" style="width: 80%">
</a>
<div class="col-md-10">
<div class="cta-button">
Download Template CV
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="tab4primary">
<center>
<h1 class="name">Pengumuman</h1>
<hr class="whitehr">
</center>
<div class="col-sm-12 col-md-12 col-xm-12">
<div class="bs-calltoaction bs-calltoaction-warning">
<div class="row">
<div class="col-sm-2 col-md-3 col-xs-8">
<img src="<?php echo base_url();?>asset/img/alur-pendaftaran/6.png" class="img-responsive">
</div>
<div class="col-md-6 cta-contents">
<h3 class="cta-title">Waktu Magang Anda Telah Selesai</h3>
<hr>
<div class="cta-desc">
</div>
</div>
<div class="col-md-3 cta-button">
Download Sertifikat
</div>
</div>
</div>
<?php
$status = $userData['status'];
if($status == 'diterima'){
$this->load->view('dashboard/diterima');
}?>
<blockquote class="quote-box"><br>
<div class="col-sm-2 col-md-3 col-xs-8">
<img src="<?php echo base_url();?>asset/img/alur-pendaftaran/3.png" class="img-responsive">
</div>
<p class="quotation-mark">“</p>
<hr>
<div class="blog-post-actions">
<p class="blog-post-bottom pull-left">
Pengumuman
</p>
<p class="blog-post-bottom pull-right">
<span class="badge quote-badge">Biro Kepegawaian Dan Organisasi</span>
</p>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</dir>
<?php $this->load->view('footer');?>
</section><!--section close-->
<script type="text/javascript" src="../asset/js/jquery.min.js"></script>
<script type="text/javascript" src="../asset/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../asset/js/profile.js"></script>
<script type="text/javascript" src="../asset/js/pemberitahuan.js"></script>
</body>
</html>
i try to make notification with php when button notification i click or was clicked, the notification will be remove by jquery or js i made, but i get stack on there, how i can remove the notification when it was clicked.
here is the code i make for remove the notification
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
and here code i made for show notification
<?php
$status = $userData['status'];//this i get from database
if($status == 'diterima'){
$notif = 'new';
}
?>
notification just text, so when $status == diterima it will be show new and when i click the button of notification and text new must be remove or gone but i got stock on there
As Berend de Groot suggested, you need to stay in JavaScript context once the page is loaded (and php stopped doing anything).
Try altering the HTML where the message is displayed directly :
<script>
$('#tab4primary').click(function(){
$('selectorWhereTheNotifTextIsWrittenInDOm').empty();
});
</script>
You may want to try to hide() instead of emptying depending on your DOM and the expected behavior.
EDIT : with the HTML you posted answer is now :
<script>
$('#tab4primary').click(function(){
$('#pemberitahuan').empty();
});
</script>
Same thing applies with hide() instead of empty()
EDIT 2 : Try :
<script>
$(document).ready(function() {
$('#tab4primary').click(function(){
$('#pemberitahuan').hide();
});
});
</script>
And make sure you remove :
<script>
$('#tab4primary').click(function(){
<?php $notif= ''?>
});
</script>
EDIT 3: #tab4primary does not seems to be the proper trigger element after all, if you try :
<script>
$('#pemberitahuan').click(function(){
$('#pemberitahuan').hide();
});
</script>
You should see something happening. It's now all a matter of selecting the proper trigger and target which should in most cases be different.
You can remove any element by jQuery remove function.
Please try the following code:
$('#tab4primary').click(function()
{
$('#tab4primary').remove();
});
or you can simply hide it using following code:
$('#tab4primary').click(function()
{
$('#tab4primary').hide();
});

assign php variable to div id and access it using jquery

I have a list of employees generated dynamically from database, and each employee has got an id, now I want to open a div box on each click with respect to the id's and display their id's in that box.
I am not able to access that div with respect to the id selected.
include 'connect.php';
$ert=mysql_query("Select * from login_session where bit='0' and date='$date'") or die(mysql_error());
while($we=mysql_fetch_array($ert)){
$employee_id=$we['employee_id'];
?>
<li> <?php echo $we['name'];?></li>
<div class="popup-box chat-popup" id="employee_<?php echo $employee_id; ?>">
<div class="popup-head">
<div class="popup-head-left pull-left"><img src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" alt="iamgurdeeposahan"> Gurdeep Osahan
</div>
<div class="popup-head-right pull-right">
<div class="btn-group">
<button class="chat-header-button" data-toggle="dropdown" type="button" aria-expanded="false">
<i class="glyphicon glyphicon-cog"></i> </button>
<ul role="menu" class="dropdown-menu pull-right">
<li>Media</li>
<li>Block</li>
<li>Clear Chat</li>
<li>Email Chat</li>
</ul>
</div>
<button data-widget="remove" class="removeClass chat-header-button pull-right" type="button"><i class="glyphicon glyphicon-off"></i></button>
</div>
</div>
<div class="popup-messages">
<div class="direct-chat-messages">
<div class="chat-box-single-line">
<abbr class="timestamp">October 8th, 2015</abbr>
</div>
<!-- Message. Default to the left -->
<div class="direct-chat-msg doted-border">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">Osahan</span>
</div>
<!-- /.direct-chat-info -->
<img alt="message user image" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img"><!-- /.direct-chat-img -->
<div class="direct-chat-text">
Hey bro, how’s everything going ?
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-timestamp pull-right">3.36 PM</span>
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-img-reply-small pull-left">
</span>
<span class="direct-chat-reply-name">Singh</span>
</div>
<!-- /.direct-chat-text -->
</div>
<!-- /.direct-chat-msg -->
<div class="chat-box-single-line">
<abbr class="timestamp">October 9th, 2015</abbr>
</div>
<!-- Message. Default to the left -->
<div class="direct-chat-msg doted-border">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">Osahan</span>
</div>
<!-- /.direct-chat-info -->
<img alt="iamgurdeeposahan" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img"><!-- /.direct-chat-img -->
<div class="direct-chat-text">
Hey bro, how’s everything going ?
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-timestamp pull-right">3.36 PM</span>
</div>
<div class="direct-chat-info clearfix">
<img alt="iamgurdeeposahan" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img big-round">
<span class="direct-chat-reply-name">Singh</span>
</div>
<!-- /.direct-chat-text -->
</div>
</div>
</div>
<div class="popup-messages-footer">
<textarea id="status_message" placeholder="Type a message..." rows="10" cols="40" name="message"></textarea>
<div class="btn-footer">
<button class="bg_none"><i class="glyphicon glyphicon-film"></i> </button>
<button class="bg_none"><i class="glyphicon glyphicon-camera"></i> </button>
<button class="bg_none"><i class="glyphicon glyphicon-paperclip"></i> </button>
<button class="bg_none pull-right"><i class="glyphicon glyphicon-thumbs-up"></i> </button>
</div>
</div>
</div>
<script>
$(function(){
$(".addClass").click(function () {
var var1=$(this).data('employee');
$('#employee_'+var1).addClass('popup-box-on');
});
$(".removeClass").click(function () {
var var1=$(this).data('employee');
$('#employee_'+var1).removeClass('popup-box-on');
});
})
</script>
Firstly , inside the anchor tag <a> with class .addClass , you are using $we['employee_id'] and then for it's respective box you are using $employee_id which is null and it results to an undefined variable error.
You should give the trigger and target selectors a unqiue identifiers , such as for .addClass you can use data attributes for appending the data to target something. look below:
<?php echo $we['name'];?>
and then for respective box id you can assign a unique id to it something like:
<div class="popup-box chat-popup" id="employee_<?php echo $employee_id; ?>">
and at the end inside javascript / jquery , you can trigger them with the data attribute value and by placing the unique identifier we have created for target div. let say .addClass's data attribute contains 34, which is a employee id , and .popup-box will have id="employee_34" as we need to identify them with something unique and not only numbers.
$(function(){
$(".addClass").click(function () {
var var1=$(this).data('employee');
$('#employee_'+var1).addClass('popup-box-on');
});
});
at the end you php and html code should look like this:
include 'connect.php';
$ert=mysql_query("Select * from login_session where bit='0' and date='$date'") or die(mysql_error());
while($we=mysql_fetch_array($ert)){
?>
<li> <?php echo $we['name'];?></li>
<div class="popup-box chat-popup" id="employee_<?php echo $employee_id; ?>">
<div class="popup-head">
<div class="popup-head-left pull-left"><img src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" alt="iamgurdeeposahan"> Gurdeep Osahan
</div>
<div class="popup-head-right pull-right">
<div class="btn-group">
<button class="chat-header-button" data-toggle="dropdown" type="button" aria-expanded="false">
<i class="glyphicon glyphicon-cog"></i> </button>
<ul role="menu" class="dropdown-menu pull-right">
<li>Media</li>
<li>Block</li>
<li>Clear Chat</li>
<li>Email Chat</li>
</ul>
</div>
<button data-widget="remove" id="removeClass" class="chat-header-button pull-right" type="button"><i class="glyphicon glyphicon-off"></i></button>
</div>
</div>
<div class="popup-messages">
<div class="direct-chat-messages">
<div class="chat-box-single-line">
<abbr class="timestamp">October 8th, 2015</abbr>
</div>
<!-- Message. Default to the left -->
<div class="direct-chat-msg doted-border">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">Osahan</span>
</div>
<!-- /.direct-chat-info -->
<img alt="message user image" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img"><!-- /.direct-chat-img -->
<div class="direct-chat-text">
Hey bro, how’s everything going ?
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-timestamp pull-right">3.36 PM</span>
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-img-reply-small pull-left">
</span>
<span class="direct-chat-reply-name">Singh</span>
</div>
<!-- /.direct-chat-text -->
</div>
<!-- /.direct-chat-msg -->
<div class="chat-box-single-line">
<abbr class="timestamp">October 9th, 2015</abbr>
</div>
<!-- Message. Default to the left -->
<div class="direct-chat-msg doted-border">
<div class="direct-chat-info clearfix">
<span class="direct-chat-name pull-left">Osahan</span>
</div>
<!-- /.direct-chat-info -->
<img alt="iamgurdeeposahan" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img"><!-- /.direct-chat-img -->
<div class="direct-chat-text">
Hey bro, how’s everything going ?
</div>
<div class="direct-chat-info clearfix">
<span class="direct-chat-timestamp pull-right">3.36 PM</span>
</div>
<div class="direct-chat-info clearfix">
<img alt="iamgurdeeposahan" src="http://bootsnipp.com/img/avatars/bcf1c0d13e5500875fdd5a7e8ad9752ee16e7462.jpg" class="direct-chat-img big-round">
<span class="direct-chat-reply-name">Singh</span>
</div>
<!-- /.direct-chat-text -->
</div>
</div>
</div>
<div class="popup-messages-footer">
<textarea id="status_message" placeholder="Type a message..." rows="10" cols="40" name="message"></textarea>
<div class="btn-footer">
<button class="bg_none"><i class="glyphicon glyphicon-film"></i> </button>
<button class="bg_none"><i class="glyphicon glyphicon-camera"></i> </button>
<button class="bg_none"><i class="glyphicon glyphicon-paperclip"></i> </button>
<button class="bg_none pull-right"><i class="glyphicon glyphicon-thumbs-up"></i> </button>
</div>
</div>
</div>
<?php } ?>
and your javascript code like below:
$(function(){
$(".addClass").click(function () {
var var1=$(this).data('employee');
$('#employee_'+var1).addClass('popup-box-on');
});
});
and do in this way same for removing the respective box for employee div.
Note
As the popup-box div's are multiple and are already inside the dom , you should not use id selector for remove trigger , as it will target only first div and not others , use an class for removing the div as well such as removeBox
Update for remove
For removing the div, don't use id for removing the div , change your remove button to the following:
<button data-widget="remove" data-employee="<?php echo $we['employee_id']; ?>" class="chat-header-button removeClass pull-right" type="button"><i class="glyphicon glyphicon-off "></i></button>
and use the below jquery code for removing the div
$(function(){
$(".removeClass").click(function () {
var var1=$(this).data('employee');
$('#employee_'+var1).removeClass('popup-box-on');
});
});

Categories

Resources