Two calendar form in one page Joomla - joomla

I implemented two calendar form in one view page in joomla component.
the code is like this:
<tr>
<td>Start Date</td>
<td><?php echo JHTML::calendar(date("Y-m-d"),'from', 'date', '%Y-%m-%d',array('size'=>'8','maxlength'=>'10','class'=>' validate[\'required\']',));
?></td>
</tr>
<tr>
<td>End Date</td>
<td><?php echo JHTML::calendar(date("Y-m-d"),'to', 'date', '%Y-%m-%d',array('size'=>'8','maxlength'=>'10','class'=>' validate[\'required\']',));
?></td>
</tr>
But now only the first calendar form would pop up a jQuery calendar that let me select a date, the second form, when clicking on it, there is no effect.
Hope someone could help me solve this problem.

You are giving same id for both calendar (Third parameter). it must be different ids for both calendar. try below code. Reference code.
<tr>
<td>Start Date</td>
<td><?php echo JHTML::calendar(date("Y-m-d"),'from', 'from_date', '%Y-%m-%d',array('size'=>'8','maxlength'=>'10','class'=>' validate[\'required\']',));
?></td>
</tr>
<tr>
<td>End Date</td>
<td><?php echo JHTML::calendar(date("Y-m-d"),'to', 'to_date', '%Y-%m-%d',array('size'=>'8','maxlength'=>'10','class'=>' validate[\'required\']',));
?></td>
</tr>

Related

how to parse field value without parsing record id with codeigniter

In my database one project has many tasks. I was able to give the edit option for each record by parsing the record id when the update button is clicked. But as one project has many task now I need to parse the projectname when the button clicked and show all the tasks related to that project. Can Somebody help me?
This is the button with record
This is the code
<table class="table table-lg">
<thead >
<tr class="filters">
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Project" disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Client" disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Task " disabled></th>
<th class="col-lg-1"><input type="text" class="form-control" placeholder="Description" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Create Date and Time" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Start Date and Time" disabled></th>
<th class="col-lg-2"><input type="text" class="form-control" placeholder="Due Date and Time" disabled></th>
<th class="col-lg-1"> Edit</th>
<th class="col-lg-1"> Delete</th>
</tr>
</thead>
<tbody>
<?php
if(isset($view_data) && is_array($view_data) && count($view_data)): $i=1;
foreach ($view_data as $key => $data) {
?>
<tr <?php if($i%2==0){echo 'class="even"';}else{echo'class="odd"';}?>>
<td><?php echo $data['projectname']; ?></td>
<td><?php echo $data['cname']; ?></td>
<td><?php echo $data['mytext']; ?></td>
<td><?php echo $data['mytext1']; ?></td>
<td><?php echo $data['mytext2']; ?></td>
<td><?php echo $data['mytext3']; ?></td>
<td><?php echo $data['mytext4']; ?></td>
<td><?php echo $data['mytext5']; ?></td>
<td><a class="btn btn-warning" role="button" href="<?php echo site_url('Task/edit_data/'. $data['id'].''); ?>"><i class="glyphicon glyphicon-pencil"></i> Edit</a></td>
<td><a type="button" class="btn btn-danger" href="<?php echo site_url();?>/Task/delete_data/<?php print($data['id']);?>">
<img src='' title="Delete" onClick="return doconfirm();" />
</a></td>
</tr>
<?php
$i++;
}
else:
?>
<tr>
<td colspan="7" align="center" >No Records Found..</td>
</tr>
<?php
endif;
?>
</tbody>
</table>

CodeIgniter delete row from database

I'm trying to delete data from my database
Here's my code:
VIEW
<table border="1" class="table">
<tr>
<th>No</th>
<th>Nama Depan</th>
<th>Nama Belakang</th>
<th>TTL</th>
<th>Email</th>
<th>Keterangan</th>
</tr>
<?php
$i = 0;
foreach ($dataMember as $result) { ?>
<tr>
<td><?php echo ($i+1); ?></td>
<td><?php echo $result['namaDepan'];?></td>
<td><?php echo $result['namaBelakang']; ?></td>
<td><?php echo $result['TTL']; ?></td>
<td><?php echo $result['email']; ?></td>
<td>
<button>Delete</button>
</td>
</tr>
<?php $i++; } ?>
</table>
MODEL
public function Hapusdata($id){
$this->db->where('email', $id);
$this->db->delete('daftar');
}
Controller
public function hapusMember()
{
$this->load->model('Member');
$this->load->helper('url');
$id = $this->uri->segment(3);
$this->Member->Hapusdata($id);
redirect (site_url('Belajarberhadiah/halaman_admin'));
}
and the problem is i get
Severity: Notice
Message: Trying to get property of non-object
Filename: views/halaman_dMember.php
Line Number: 105
What should i do?
Please write href for delete tag as below:
delete
Also be sure that the column[email] you have used for where condition in controller is the correct one. Because column name is "email" in where condition and you are passing an integer value.

how to make individual profile page?

i am new to the programming.i have list of customer in table.i want to make the individual profile page for each customer with their database credentials.So how can i do it to make name clickable so their profile page will open (in codeigniter).this is my table....
<table>
<thead>
<tr>
<th scope="col">S/N</th>
<th scope="col">Customer Name</th>
<th scope="col">Customer Email</th>
<th scope="col">Customer Country</th>
<th scope="col">Customer City</th>
<th scope="col">Customer Address</th>
<th scope="col">Customer Contact</th>
<th scope="col">Customer Image</th>
<th scope="col">Modify</th>
</tr>
</thead>
<tbody>
<?php $i = 1;?>
<?php if($customer->num_rows()>0):?>
<?php foreach($customer->result() as $rows):?>
<tr>
<td><?php echo $i;?></td>
<td><a href="<?php base_url();?>admin/customer/profile"<?php echo $rows->customer_name;?><a></td>
<td><?php echo $rows->customer_email;?></td>
<td><?php echo $rows->customer_country;?></td>
<td><?php echo $rows->customer_city;?></td>
<td><?php echo $rows->customer_address;?></td>
<td><?php echo $rows->customer_contact;?></td>
<td><img id="img" src="<?php echo base_url();?>customer/<?php echo $rows->customer_image;?>" width="30px" height="30px"/></td>
<td>
</td>
</tr>
<?php $i++;?>
<?php endforeach;?>
<?php endif;?>
</tbody>
</table>

Stop for loop repeating tables

I have a for loop inserting data into my table, works well.
Problem is each loop I wish for it to start a new row, but it starts a new table. any ideas how to fix this?
<?php if (isset($records)) : foreach ($records as $row) : ?>
<div id="mobile-content">
<table class="table table-hover">
<thead>
<tr>
<th>Account Name</th>
<th>Balance</th>
<th>Start Date</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $row->bank_name; ?></td>
</tr>
<tr>
<td><?php echo $row->bank_balance; ?></td>
</tr>
<tr>
<td><?php echo $row->bank_start_date; ?></td>
</tr>
</tbody>
</table>
</div>
<?php endforeach; ?>
You should change the code to loop inside the table body, not in the whole table code:
<div id="mobile-content">
<table class="table table-hover">
<thead>
<tr>
<th>Account Name</th>
<th>Balance</th>
<th>Start Date</th>
</tr>
</thead>
<tbody>
<?php if (isset($records)) : foreach ($records as $row) : ?>
<tr>
<td><?php echo $row->bank_name; ?></td>
<td><?php echo $row->bank_balance; ?></td>
<td><?php echo $row->bank_start_date; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
Note: I've also remove extra <tr> because you need one row for the three cells.
I hope that helps :D

Creating table dynamically using codeigniter?

I want to show my search output in a table using Codeigniter. Suppose if user wants to search all the volunteers of his location then the result should be shown in a table containing volunteer name,conatct no etc. Any kind of help will be realy appreciable.
You can use the CI active record class:
http://www.codeigniter.com/userguide2/database/active_record.html#select
<table>
<tr>
<th>Name</th>
<th>contact</th>
</tr>
<?php
$query = $this->db->get_where('mytable', array('feild_to_search' => 'search_query'));
foreach ($query->result() as $row)
{
?>
<tr>
<td><?php echo $row->name ?></td>
<td><?php echo $row->contact ?></td>
</tr>
<?php
}
?>
</table>
:)

Resources