I'm trying to get a text from the database but it overflows it's container. I tried putting a lot of lorem ipsum in the original code without the database info and it works fine.
This is what happen when I get the info directly from the database:
And this is a native lorem ipsum in the html file:
This is my html code:
<div class="col-md-8">
<div class="row">
<?php
$query = $mysqli->query("SELECT id,title,preview,author,timepost FROM news ORDER BY timepost DESC LIMIT 3");
$i = 1;
while($array = $query->fetch_array())
{
$date = DateTime::createFromFormat("Y-m-d H:i:s",$array['timepost']); ?>
<div class="col-md-12 mb-3" style="cursor: default;" id="<?php echo 'newsJunebia' . $i; $i++; ?>">
<div class="row">
<div class="col-md-12 bg-negro text-white rounded-top">
<strong><?= $array['title']; ?></strong>
</div>
</div>
<div class="row">
<div class="col-md-8 bg-negro-opacity text-naranja">
<small><em>Publicado el <?=$date->format('d');?> de <?= $date->format('F') ?>o del <?= $date->format('Y'); ?> a las <?= $date->format('H:i') ?></em></small>
</div>
<div class="col-md-4 bg-negro-opacity text-naranja d-flex flex-row-reverse">
<small><em>Autor: <?= $array['author']; ?></em></small>
</div>
</div>
<div class="row">
<div class="col-md-12 bg-negro-opacity text-white">
<p><?php echo $array['preview']; ?></p>
</div>
</div>
<div class="row">
<div class="col-md-12 bg-negro-opacity text-naranja rounded-bottom text-center">
<span style="cursor: pointer;" class="font-weight-bold font-italic text-naranja plusNews">Ver la noticia completa</span>
</div>
</div>
</div>
<?php } ?>
This is the form from where I save this info:
<div class="row">
<div class="col-md-12 mt-4">
<div class="card">
<div class="card-header bg-negro text-white">
<h5 class="card-title text-center">Agregar noticia</h5>
</div>
<form class="form" role="form" method="POST" id="form-news">
<input type="hidden" name="dblanguage" value="es_LA">
<div class="card-body bg-gris text-naranja font-weight-bold">
<div class="form-group">
<label for="newsType">Categoría de la noticia</label>
<select class="custom-select" id="newsType" name="newsType" disabled>
<option>Noticia Junebia</option>
</select>
</div>
<div class="form-group">
<label for="newsTitle">Título de la noticia (<span id="maxCharTitle">60</span> caracteres restantes)</label>
<input type="text" name="newsTitle" id="newsTitle" class="form-control" maxlength="60">
</div>
<div class="form-group">
<label for="newsPreview">Texto de vista previa (<span id="maxChar">120</span> caracteres restantes)</label>
<textarea type="text" name="newsPreview" id="newsPreview" class="form-control" maxlength="100"></textarea>
</div>
<div class="form-group">
<label for="newsContent">Contenido de la noticia</label>
<textarea id="newsContent" name="newsContent" class="form-control"></textarea>
</div>
<input type="hidden" name="username" value="<?= $_SESSION['userName'] ?>">
</div>
<div class="container-fluid justify-content-center d-flex bg-gris">
<button type="submit" class="btn btn-naranja btn-lg mb-2" id="btnAgregar">Agregar</button>
</div>
</form>
</div>
</div>
This is my php file to handle that form:
require_once('../database.php');
if(!isBanned() && isAdmin())
{
if(isset($_POST['newsTitle']))
{
$newsTitle = $_POST['newsTitle'];
$newsPreview = $_POST['newsPreview'];
$newsContent = $_POST['newsContent'];
$newsAuthor = $_POST['username'];
$newsTime = date('Y-m-d H:i:s');
$stmt = $mysqli->prepare("INSERT INTO news(title,preview,content,author,timepost) VALUES(?,?,?,?,?)");
$stmt->bind_param('sssss',$newsTitle,$newsPreview,$newsContent,$newsAuthor,$newsTime);
$stmt->execute();
echo true;
}
else
{
echo false;
}
}
else
{
echo false;
}
I'm using bootstrap 4.1
You just need a space and everything will be fine.
But if your text is looks like as you fetch. You can just try the following css with parent div of text:
word-break: break-all;
Related
I'm trying to send data from a form to a PHP page, via AJAX, but I'm not sure if I'm doing it correctly, because I'm not able to echo these variables.
Here is the code of the page containing the form (some information has been hidden, but the code is working):
<body>
<div class="container">
<div class="row">
<div class="mt-5 col-12 col-md-12 col-lg-12">
<form id="adicionar_funcionario" method="POST" enctype="multipart/form-data" class="p-md-5">
<h2 class="text-center"><?php echo $titulo; ?></h2>
<div style="float: left;" class="mt-5">
<img src="../img/avatar.png" alt="Selecione uma imagem" <?php if(isset($errofoto)){echo "class='invalidoimg imgupload'";}else{echo "class='imgupload'";}?> id="imgfoto">
<img src="../img/lixeira.png" id="lixeira" alt="Limpar foto" class="lixeira">
<span class="erro"><?php if(isset($errofoto)){echo $errofoto;}?></span>
</div>
<div class="row mt-5">
<div class="ms-2 ms-lg-5 text-center col-5 col-lg-1 col-md-2 col-sm-2">
<!-- SITUAÇÃO -->
<label for="situacao"> Situação: </label>
</div>
<div class="col-7 col-lg-2 col-md-4 col-sm-4">
<div class="form-check form-switch">
<input id="situacao" name="situacao" class="form-check-input" type="checkbox" value="1" onclick="mudarlabel(this.checked)" <?php if(isset($situacao)){echo "checked";}else{echo "checked";} ?>>
<label class="form-check-label" for="situacao" id="labelsituacao"><?php if(isset($situacao)){echo "Ativado";}else{echo "Ativado";} ?></label>
</div>
</div>
</div>
<div class="ms-lg-5 mt-4 col-12 col-md-12 col-lg-12">
<div class="row">
<div class="ms-lg-5 col-12 col-lg-4 col-md-4 col-sm-4">
<!-- PRONOME -->
<label for="pronome"> Pronome </label>
<select id="pronome" <?php if(isset($erropronome)){echo "class='invalido form-select'";}else{echo "class='form-select'";}?> <?php if (isset($_POST['pronome'])){echo "value='".$_POST['pronome']."'";}?> name="pronome">
<?php
if ((isset($_POST['pronome']))){
?>
<option selected><?php echo $_POST['pronome'];?></option>
<?php
}else{
?>
<option selected>Selecione uma opção</option>
<?php
};
?>
<option value="Ele/Dele">Ele/Dele</option>
<option value="Ela/Dela">Ela/Dela</option>
<option value="Todos">Todos</option>
</select>
<span class="erro"><?php if(isset($erropronome)){echo $erropronome;}?></span>
</div>
<div class="col-12 col-lg-4 col-md-4 col-sm-4">
<!-- NOME COMPLETO -->
<label for="nomecompleto"> Nome completo </label>
<input type="text" id="nomecompleto" placeholder="Como consta no CPF..."<?php if(isset($erronomecompleto)){echo "class='invalido form-control'";}else{echo "class='form-control'";}?> <?php if (isset($_POST['nomecompleto'])){echo "value='".$_POST['nomecompleto']."'";}?> name="nomecompleto">
<span id="erronomecompleto" class="erro"><?php if(isset($erronomecompleto)){echo $erronomecompleto;}?></span>
</div>
</div>
</div>
<div class="ms-lg-5 mt-4 col-12 col-md-12 col-lg-12">
<div class="row">
<div class="ms-lg-5 col-12 col-lg-4 col-md-3 col-sm-4">
<!-- NOME SOCIAL -->
<label for="nomesocial"> Nome social </label>
<input type="text" id="nomesocial" placeholder="Gostaria de ser chamado(a)..." <?php if(isset($erronomesocial)){echo "class='invalido form-control'";}else{echo "class='form-control'";}?> <?php if (isset($_POST['nomesocial'])){echo "value='".$_POST['nomesocial']."'";}?> name="nomesocial">
<span class="erro"><?php if(isset($erronomesocial)){echo $erronomesocial;}?></span>
</div>
<div class="col-12 col-lg-4 col-md-3 col-sm-4">
<!-- NOME -->
<label for="nomeartistico"> Nome Artístico </label>
<input type="text" id="nomeartistico" placeholder="Irá aparecer nos créditos..." <?php if(isset($erronomeartistico)){echo "class='invalido form-control'";}else{echo "class='form-control'";}?> <?php if (isset($_POST['nomeartistico'])){echo "value='".$_POST['nomeartistico']."'";}?> name="nomeartistico">
<span class="erro"><?php if(isset($erronomeartistico)){echo $erronomeartistico;}?></span>
</div>
</div>
</div>
<input accept="image/png,image/jpeg,image/jpg" type="file" id="foto" name="foto">
<input type="text" id="removerfoto" name="removerfoto">
<div class="form-group text-center">
<button id="criar" type="submit" class="mt-5 botao">Criar</button>
</div>
</div>
<!-- Modal -->
<div class="modal hide fade" id="anexar_documentos" tabindex="-1" role="dialog" aria-labelledby="Documentacao" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title" id="TituloModalLongoExemplo">Anexar documentos</h3>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Fechar">
<span aria-hidden="true">×</span>
</button>
</div>
<h6 class="ms-3 mt-2"><b><i>Os arquivos precisam ser no formato jpg, png ou pdf e ter, no máximo, 2 MB</i></b></h6>
<div id="anexos" class="modal-body">
Escolha um regime, um cargo e um nível para anexar os documentos
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../bootstrap/_bootstrap/js/enviar_formulario_adicionar_funcionario.js"></script>
</body>
</htlm>
Here is the AJAX code, being called as enviar_formulario_adicionar_funcionario.js:
$(document).ready(function(){
$("#criar").click(function(){
event.preventDefault();
var dados = new FormData(document.getElementById("adicionar_funcionario"));
$.ajax({
url: '../utilities/criarfuncionario.php',
method: 'POST',
dataType: 'json',
cache: false,
contentType: false,
processData: false,
data: {
data: dados
},
success: function(resultado){
alert(resultado.erronomecompleto);
}
})
})
})
And here is the page being sent the data (again some data was removed as it was not relevant to the problem):
<?php
if (((isset($_POST['nomecompleto'])) || (isset($_POST['nomesocial'])) ||
(isset($_POST['nomeartistico'])) || (isset($_POST['telefone'])) ||
(isset($_POST['rg'])) || (isset($_POST['cpf'])) || (isset($_POST['email'])) ||
(isset($_POST['datanasc'])) || (isset($_POST['endereco'])) ||
(isset($_POST['bairro'])) || (isset($_POST['complemento'])) ||
(isset($_POST['cidade'])) || (isset($_POST['cep'])) ||
(isset($_POST['datacontratacao'])) || (isset($_POST['cargo'])) ||
(isset($_POST['projeto'])) || (isset($_POST['datasaida'])) ||
(isset($_POST['regime'])) || (isset($_POST['telefone'])) ||
(isset($_FILES['foto'])) || (isset($_POST['uf'])) ||
(isset($_POST['numero'])) || (isset($_POST['inicio_ferias'])) ||
(isset($_POST['fim_ferias']))) &&
(strpos($_SERVER['REQUEST_URI'], 'cadastro_convite') == false)){
echo json_encode(array ('erronomecompleto' => 'Passei aqui'));
$dados = filter_input_array(INPUT_POST, FILTER_DEFAULT);
$query_campo_obrigatorio = "SELECT * FROM campo_obrigatorio";
$campo_obrigatorio_banco = $conn->prepare($query_campo_obrigatorio);
$campo_obrigatorio_banco->execute();
while($campo_obrigatorio = $campo_obrigatorio_banco->fetch(PDO::FETCH_ASSOC)){
if($campo_obrigatorio['campo_nomecompleto'] == '1'){
if((empty($dados['nomecompleto'])) || (str_replace(" ", "", $dados['nomecompleto']) == "")){
$erronomecompleto = 'Preencha este campo';
}
if(!preg_match("/^[a-zA-Z-' \pL]*$/u", limpapost($dados['nomecompleto']))){
$erronomecompleto = "Apenas letra e espaços em branco neste campo";
}else{
$nomecompleto = limpapost($dados['nomecompleto']);
}
}else{
if((empty($dados['nomecompleto'])) || (str_replace(" ", "", $dados['nomecompleto']) == "")){
$nomecompleto = "";
}
if(!preg_match("/^[a-zA-Z-' \pL]*$/u", limpapost($dados['nomecompleto']))){
$erronomecompleto = "Apenas letra e espaços em branco neste campo";
}else{
$nomecompleto = limpapost($dados['nomecompleto']);
}
}
When I put the echo json_encode inside the IF conditions, I don't get a response, however, if I put it outside the IF conditions, I get the return "Passei aqui".
So I came to the conclusion that my $POST['anything'] is probably not getting anything.
I also tried to pass a value to any field and send the data (to see if it entered the IF conditions), however, I didn't get a return.
I apologize in advance, as I am new to this subject.
This is my view file here i use 5 search field like product, group, branch, startdate and end date. All are placed in different table. Both were worked nicely and searched nicely but now i want some additional option that is when i select a particular branch in group field dynamically show values based on branch field value. Now it is showing whole data in db.
NOTE: i want this change appear when dropdown select.
<div class="row">
<div class="col-md-12">
<div class="tab-content">
<form method="get" id="frmSearchGroupPur" action="<?php echo
base_url('admin/group/listgroup'); ?>">
<div class="form-body">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="col-md-5 control-label"
style="text-align: left">Product</label>
<div class="col-md-7">
<?php
$product = array();
// if($data['products']){
// foreach ($data['products'] as
$p)
{
// $product[$p['id']] =
$p['name'];
// }
// }
echo form_dropdown('product', $product,
$data['product'], array('class' => 'form-control
select2','id'=>'product'));
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-5 control-label"
style="text-align: left">Branch</label>
<div class="col-md-7">
<?php
$branch = array(NULL=>'Any');
if($data['branches']){
foreach ($data['branches'] as $w){
$branch[$w['id']] = $w['name'];
}
}
echo form_dropdown('branch', $branch,
$data['branch'], array('class' => 'form-control','id'=>'branch_dat'));
?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-5 control-label"
style="text-align: left">Group</label>
<div class="col-md-7">
<?php
$group = array(NULL=>'Any');
if($data['groups']){
foreach ($data['groups'] as $g){
$group[$g->id] = $g->name;
}
}
echo form_dropdown('group', $group,
$data['group'], array('class' => 'form-control'));
?>
</div>
</div>
</div>
</div><br/>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label class="col-md-5 control-label"
style="text-align: left">Purchase Date From</label>
<div class='input-group date col-md-7'
id='datetimepicker6'>
<?php echo
form_input('fromdate',$data['fromdate'],array('class' => 'form-
control','id'=>'fromdate')); ?>
<span class="input-group-addon">
<span class="glyphicon glyphicon-
calendar"></span>
</span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label class="col-md-5 control-label"
style="text-align: left">Purchase Date To</label>
<div class='input-group date col-md-7'
id='datetimepicker7'>
<?php echo
form_input('todate',$data['todate'],array('class' => 'form-
control','id'=>'todate')); ?>
<span class="input-group-addon">
<span class="glyphicon glyphicon-
calendar"></span>
</span>
</div>
</div>
</div>
</div><br/>
<div class="row">
<div class="col-md-4">
<div class="form-group pull-center">
<button type="submit" id="btnFilter" class="btn
btn-info">Submit</button>
<a href="<?php echo
base_url('admin/group/listgroup'); ?>" class="btn btn-default">Reset</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
and my model file to get group is
function getGroupDetails($groupid=0,$state=''){
$this->db->where('id',$groupid);
$this->db->where('branchid',$state);
$query = $this->db->get('group');
if($query->num_rows()==1){
return $query->row_array();
}else{
return FALSE;
}
and my controller function is
function get_group(){
$state=$this->input->post('brch');
$result = $this->model_group->getGroupDetails($state);
// echo json_decode($result);
}
and my not worked jquery file to change group dynamically is below
$('branch_dat').change(function(){
var branch_da=$('#branch_dat').val();
if(branch_da != "")
{
var post_url="admin/sale/get_group";
$('branch_dat').change(function(){
var branch_da=$('#branch_dat').val();
if(branch_da != "")
{
var post_url="admin/sale/get_group";
$.ajax({
type:"POST",
url:post_url,
data:function(params)
{
return{ brch : params.brch};
}
});
}
});
I try to tidy up the display form.
The page devided by 2 colomn. But when i input many of value or select, the display is messy. I have to set the "}" in anywhere but doesn't work.
This is the screenshot:
This is the code:
<h3 class="form-section">Data Kegiatan</h3>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><b>Nama Proposal :</b></label>
<div class="col-md-9">
<p class="form-control-static"> <?php echo $proposalName; ?></p>
</div>
</div>
</div>
<!--/span-->
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><b>Jenis Bantuan :</b></label>
<?php
$no=0;
$stmt = $reg_user->runQuery("SELECT * FROM tbl_proposal_detail_jenis_bantuan WHERE proposalID='".$_GET['id']."'");
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_OBJ);
while($new_arr=$stmt->fetch()){
$stmt2 = $reg_user->runQuery("SELECT * FROM tbl_jenis_bantuan WHERE jenisBantuanID='".$new_arr->jenisBantuanID."'");
$stmt2->execute();
$stmt2->setFetchMode(PDO::FETCH_OBJ);
while($data=$stmt2->fetch()){
$no++;
?>
<div class="col-md-9">
<p class="form-control-static"> <?php echo $no.". ". $data->Name;?></p>
</div>
<?php }} ?>
</div>
</div>
<!--/span-->
</div>
<!--/row-->
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><b>Detail Bantuan:</b></label>
<div class="col-md-9">
<p class="form-control-static"> <?php echo $supportDetail; ?> </p>
</div>
</div>
</div>
<!--/span-->
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><b>Sub Sektor:</b></label>
<?php
$no=0;
$stmt = $reg_user->runQuery("SELECT * FROM tbl_proposal_detail_sub_sektor WHERE proposalID='".$_GET['id']."'");
$stmt->execute();
$stmt->setFetchMode(PDO::FETCH_OBJ);
while($new_arr=$stmt->fetch()){
$stmt2 = $reg_user->runQuery("SELECT * FROM tbl_sub_sektor WHERE subSektorID='".$new_arr->subSektorID."'");
$stmt2->execute();
$stmt2->setFetchMode(PDO::FETCH_OBJ);
while($data=$stmt2->fetch()){
$no++;
?>
<div class="col-md-9">
<p class="form-control-static"> <?php echo $no.". ".$data->subSektorName;?></p>
</div>
</div>
<?php }} ?>
</div>
<!--/span-->
</div>
Try to put all those label tag inside a div container something as:
<div class = "col-md-3">
<label class="control-label"><b>Detail Bantuan:</b></label>
<div>
<div class="col-md-9">
<p class="form-control-static"> <?php echo $no.". ". $data->Name;?></p>
</div>
This is just an example put all those label in "col-md-3"container. This should work.
This is the cause:
This Code
<div class="col-md-9">
is include in Looping. I just take that code out of looping. And its Work. Thanks!
I could not display flash message in my project (view file), any body help I kill my several time to display $flash message in my view page. I am new in counterfeiter, trying to learn something from online.
Controller :
function delete_image($update_id)
{
if(!is_numeric($update_id))
{
redirect('site_security/not_allowed');
}
$this->load->library('session');
$this->load->module('site_security');
$this->site_security->_make_sure_is_admin();
$data = $this->fetch_data_from_db($update_id);
$picture = $data['picture'];
$big_pic_path = './media/blog_pics/'.$picture;
$small_picture = str_replace('.', '_thumb.', $picture);
$small_pic_path = './media/blog_pics/'.$small_picture;
//attempt to remove the images
if (file_exists($big_pic_path)) {
unlink($big_pic_path);
}
if (file_exists($small_pic_path)) {
unlink($small_pic_path);
}
//update the database
unset($data);
$data['picture'] = "";
$this->_update($update_id, $data);
$flash_msg = "The image was successfully deleted.";
$value = '<div class="alert alert-success" role="alert">'.$flash_msg.'</div>';
$this->session->set_flashdata('item', $value);
redirect('blog/create/'.$update_id);
}
View File :
<h1><?= $headline ?></h1>
<?= validation_errors("<p style='color: red;'>", "</p>") ?>
<?php
if(isset($flash)){
echo $flash;
}
?>
<?php
if(is_numeric($update_id)) { ?>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon white edit"></i><span class="break"></span>Additional Option</h2>
<div class="box-icon">
<i class="halflings-icon white chevron-up"></i>
<i class="halflings-icon white remove"></i>
</div>
</div>
<div class="box-content">
<?php
if($picture==""){
?>
<button type="button" class="btn btn-primary">Upload Image</button>
<?php
}
else
{
?>
<button type="button" class="btn btn-danger">Delete Image</button>
<?php
}
if($update_id>2){
?>
<button type="button" class="btn btn-danger">Delete Blog Entry</button>
<?php
}
?>
<button type="button" class="btn btn-default">View Blog Entry</button>
</div>
</div><!--/span-->
</div><!--/row-->
<?php
}
?>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon white edit"></i><span class="break"></span>Blog Entry Details</h2>
<div class="box-icon">
<i class="halflings-icon white chevron-up"></i>
<i class="halflings-icon white remove"></i>
</div>
</div>
<div class="box-content">
<?php
$form_location = base_url()."blog/create/".$update_id;
?>
<form class="form-horizontal" method="post" action="<?= $form_location ?>">
<fieldset>
<div class="control-group">
<label class="control-label" for="typeahead">Date Published </label>
<div class="controls">
<input type="text" name="date_published" class="input-xlarge datepicker" id="date01" value="<?= $date_published ?>">
</div>
</div>
<div class="control-group">
<label class="control-label" for="typeahead">Blog Entry Title </label>
<div class="controls">
<input type="text" class="span7" name="page_title" value="<?= $page_title ?>">
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label">Blog Entry Keywords</label>
<div class="controls">
<textarea class="span7" rows="3" name="page_keywords"><?php echo $page_keywords; ?> </textarea>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label">Blog Entry Description</label>
<div class="controls">
<textarea class="span7" rows="3" name="page_description"><?php echo $page_description; ?> </textarea>
</div>
</div>
<div class="control-group hidden-phone">
<label class="control-label" for="textarea2">Blog Entry Content</label>
<div class="controls">
<textarea class="cleditor" id="textarea2" rows="3" name="page_content"><?php echo $page_content; ?> </textarea>
</div>
</div>
<div class="control-group">
<label class="control-label" for="typeahead">Author </label>
<div class="controls">
<input type="text" class="span7" name="author" value="<?= $author ?>">
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary" name="submit" value="Submit">Submit</button>
<button type="submit" name="submit" value="Cancel" class="btn">Cancel</button>
</div>
</fieldset>
</form>
</div>
</div><!--/span-->
</div><!--/row-->
<?php
if(isset($picture) && ($picture!=null) ){
?>
<div class="row-fluid sortable">
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon white edit"></i><span class="break"></span>Image</h2>
<div class="box-icon">
<i class="halflings-icon white chevron-up"></i>
<i class="halflings-icon white remove"></i>
</div>
</div>
<div class="box-content">
<img src="<?= base_url() ?>media/blog_pics/<?= $picture ?>" class="thumbnail" width="100">
</div>
</div><!--/span-->
</div><!--/row-->
<?php
}
?>
If you want to get the flashdata message you have set
Try
<?php if($this->session->flashdata('item')) {?>
<?php echo $this->session->flashdata('item');?>
<?php }?>
Your just change this code
<?php
if(isset($flash)){
echo $flash;
}
?>
To
<?php
if(isset($this->session->flashdata('item'))){
echo $flash;
}
?>
In your controller change
$flash_msg = "The image was successfully deleted.";
$value = '<div class="alert alert-success" role="alert">'.$flash_msg.'</div>';
$this->session->set_flashdata('item', $value);
To
$this->session->set_flashdata('item', 'The image was successfully deleted.');
In your view page add
<?php if($this->session->flashdata('item')){ ?>
<div class="alert alert-success">
<h4><?php echo $this->session->flashdata('item'); ?></h4>
</div>
<?php } ?>
I am using a table to retrieve all the data from the database and an array of view button on each table row. If the view button is clicked, a modal will appear displaying all the information of the particular row.
The problem is that the only id read is the last id. Giving the same view results for each table row.
I have this line of code in the view button:
< button class="btn btn-info" data-toggle="modal" data-target="#myModal-viewaccountinfo">View< / button>
While my modal code is this:
<div class="modal fade" id="myModal-viewaccountinfo" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h3 class="modal-title"><center>USER ACCOUNT INFORMATION</center></h3>
</div>
<div class="modal-body">
<form method="post" action="">
<br>
<?php
$id = $_GET['txtid'];
include ("connect.php");
$i ="select * from usersvis where userid=".$id;
$h= mysql_query($i);
if($tr=mysql_fetch_array($h))
{
?>
<div class="row">
<div class="col-lg-4">
Name:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[3] . ' ' . $tr['4'] . ' ' . $tr['2']; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Username:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[5]; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Password:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[6]; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Gender:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[7]; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Birthdate:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[8] . '-' . $tr['9'] . '-' . $tr['10']; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Address:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[11]; ?></label>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-4">
Status:
</div>
<div class="col-lg-6">
<label type="text"><?php echo $tr[12]; ?></label>
</div>
</div>
<br>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>