Hi everybody !
I created a search form with chronoconnectivity.
it searches ok . But when i open the form, the data is displayed.
I want to invisible the data, then i enter the Key to search, the data is displayed.
please help me !
I created a search form with chronoconnectivity.
it searches ok . But when i open the form, the data is displayed.
I want to invisible the data, then i enter the Key to search, the data is displayed.
please help me !
Hi tonythuan,
You'll need to add some PHP to the body to say "display nothing if the search field is empty"
Bob
You'll need to add some PHP to the body to say "display nothing if the search field is empty"
Bob
Thank to your quick response .
Please show me clearly !
this is my form :
WHERE SQL "
Header :
Body :
Please show me clearly !
this is my form :
WHERE SQL "
<?php
$search_array = array( 'tenchinhanh');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '$value%' ";
}
}
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}?>
Header :
<h3>Thống kê xuất tuyến</h3>
<br>
<h2><a href = "index.php?option=com_chronoconnectivity&connectionname=chinhanh_tk">Quay lại </a></h2>
<br>
<div style="float:left">
<b>Tên Chi Nhánh</b>: <input type="text" name="tenchinhanh">
<input type="submit" value="Xem" name="undefined" style='width:80px; color:#cccccc; background-color:#222222; cursor:pointer;' /></div>
<br>
<STYLE TYPE="text/css">
<!--
.darkrow, .darkrow TD, .darkrow TH
{
background-color:#99CCFF;
color: #000000;
}
-->
</STYLE>
<br>
<br>
<div style="width: 710px; height: 300px; overflow: scroll; border: 1px dashed black; background-color: #fffff;">
<table style="text-align: left; width: 800px;" border="1" cellpadding="2" cellspacing="0">
<tr CLASS="darkrow">
<td>Tên Chi Nhánh</td>
<td>Mã Xuất tuyến</td>
<td>Tên Xuất tuyến</td>
<td>Vị Trí Đầu</td>
<td>Vị Trí Cuối</td>
<td>Chiều Dài</td>
<td></td>
</tr>
Body :
<tr>
<td>{tenchinhanh}</td>
<td>{maxuattuyen}</td>
<td>{tenxuattuyen}</td>
<td>{vitridau}</td>
<td>{vitricuoi}</td>
<td>{chieudai}</td>
</tr>
Hi,
try to make your first code like:
try to make your first code like:
<?php
$search_array = array( 'tenchinhanh');
$where = array();
foreach ( $search_array as $search ) {
$value = JRequest::getVar($search, '' , 'post');
if ( $value ) {
$where[] = " $search LIKE '$value%' ";
}
}
if ( !empty($where) ) {
echo " WHERE ".implode(' AND ', $where);
}else{
echo " WHERE primary_field='non_existing_value'";
}
?>
This topic is locked and no more replies can be posted.
