Display form is messy - php

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!

Related

select dropdown value depending first dropdown value in codeigniter php

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};
}
});
}
});

Text from database overflow bootstrap container

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;

What is the master rules of grape html element by find method of simple dome parse

I am using simple_html_dome and I want to grab experience, education, and title.
By my code, I am getting (Call to a member function find() on null in ) error message but title is showing error is ($notrmjobs = $item->find('div[class=norm-jobs-wrapper]',0);) here.
What is the core rules to catch HTML tag by find method?
<div class="boxed">
<div class="row">
<div class="col-md-12">
<div class="norm-jobs-wrapper" onclick="DivOpen('id=734675&fcatId=1&ln=1');">
<div class="row">
<div class="col-sm-3 col-sm-push-3">
<!--<div class="row">
<div class="col-sm-12">
<div class="comp_logo"><img src="images/38951.jpg" alt=""></div>
</div>
</div>-->
</div>
<div class="col-sm-9 col-sm-pull-9">
<div class="row">
<div class="col-sm-12">
<div class="comp-name-text">GBA Techno Pvt. Ltd.</div>
</div>
<div class="col-sm-12">
<div class="job-title-text">
<a onclick="clickJObTitle()" target="_blank" href="jobdetails.asp?id=734675&fcatId=1&ln=1">
Sr. Executive, Accounts
</a>
</div>
</div>
<div class="col-sm-12">
<div class="edu-text">
<div class="row">
<div class="col-sm-2">
<div class="edu-text-s">
Education:
</div>
</div>
<div class="col-sm-10">
<div class="edu-text-d">
Masters/ MBA in Accounts or Finance from any reputed university
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12">
<div class="row">
<div class="col-sm-9">
<div class="exp-text">
<div class="row">
<div class="col-sm-2">
<div class="exp-text-s">Experience:</div>
</div>
<div class="col-sm-10">
<div class="exp-text-d">
At least 3 year(s)
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="dead-text">
<div class="dead-text-s">Deadline: </div>
<div class="dead-text-d">
<strong>Dec 13, </strong>2017
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include 'simple_html_dom.php';
$html = file_get_html('http://jobs.bdjobs.com/jobsearch.asp?fcatId=1&icatId=');
$boxed = $html->find('div[class=boxed]',0);
$raw = $boxed->find('div[class=row]');
foreach($raw as $key => $loop){
$item = $loop->find('div[class=col-md-12]',0);
$notrmjobs = $item->find('div[class=norm-jobs-wrapper]',0);
$raw = $notrmjobs->find('div[class=row]',0);
$sdivice = $raw->find('div[class=col-sm-9 col-sm-pull-9]',0);
$sraw = $sdivice->find('div[class=row]',0);
$asraw = $sraw->find('div[class=col-sm-12]',0);
$title = $asraw->find('div[class=comp-name-text]',0)->plaintext;
echo $title;
}
?>

PHP PDO array, only result one row

The result keep showing one row, any idea? All answers on other questions don't seem to help..
<?php
$stmt = $DB_con->prepare('SELECT * FROM members ORDER BY user_id ASC');
$stmt->execute();
$row = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach($row as $row_user) {
?>
<div id="tab-2" class="tab-content">
<div class="flex-direction-column animated fadeInUp">
<div class="notification">
<div class="row">
<span>pic</span>
</div>
<div class="row">
<span>name</span>
</div>
<div class="row">
<span>nim</span>
</div>
<div class="row">
<span>occupation</span>
</div>
<div class="row">
<span>description</span>
</div>
</div>
<div class="notification">
<div class="row-inner">
<span><?php echo $row_user['user_pic']; ?></span>
</div>
<div class="row-inner">
<span><?php echo $row_user['user_fullname']; ?></span>
</div>
<div class="row-inner">
<span><?php echo $row_user['user_nim']; ?></span>
</div>
<div class="row-inner">
<span><?php echo $row_user['user_occupation']; ?></span>
</div>
<div class="row-inner">
<span><?php echo $row_user['user_desc']; ?></span>
</div>
</div>
</div>
</div>
<?php
}
?>

Viewing Data From a Table To Modal Using 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
}
?>

Categories