|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
duydhk Smarty n00b
Joined: 03 Jul 2013 Posts: 1
|
Posted: Wed Jul 03, 2013 8:21 am Post subject: New babi need help with "Load data from selected item&q |
|
|
Im new babi in PHP and smarty, need all yor help
I need a code that show the data from what I selected.
I need 2 page, page 1 :
Quote: |
$sqlrail = "select rail.rail_id,rail.name from m_rail rail where code>0";
$resultrail = pg_query($dbconn, $sqlrail) or die ("false2");
$rail ;
$i=0;
$j=1;
$count;
while ($row = pg_fetch_row($resultrail)) {
$sqlCount= "select a.bukken_mst_id, a.bk_name,b.price1 from bukken_mst a
inner join t_bukken b on a.bukken_mst_id=b.bukken_mst_id and a.rail= ".$row[0]."
left join m_rail c on a.rail = c.rail_id ";
$result = pg_query($dbconn,$sqlCount)or die ("false");
$count[$j++]= pg_num_rows($result);
$rail[$row[0]]= $row[1];
}
//print_r($district);
$smarty->assign("count", $count);
$smarty->assign("rail", $rail);
$smarty->display("search_rail.html");
|
And here is the template :
Quote: |
<div class="s_Inbox">
<h2>Please chose<span>selected</span></h2>
<form method="GET" name="search_rail" action = "post">
<h3>Rail JR</h3>
<div class="cf">
<ul>
{$i=0}
{foreach from=$rail key= k1 item=foo}
<li>
<input type="checkbox" name="chiiki[1000]" value="1000" id="1000" onClick="setCookie('chiiki[1000]');" />
<a href="search_list_gaikan.php?rail_id={$k1}">{$foo}</a><span> ({$count[$i]})</span></li>
{$i=$i+1}
{/foreach}
</ul>
</div>
</form>
<div class="kensakubox">
<p class="kensaku_btn_sub"><a href="search_rail_detail.php" rel="internal">Search detail≫</a></p>
<p class="kensaku_btn mr10"><a href="#">Search</a></p>
</div>
</div>
</div>
|
The fisrt page I have already code, it show the data of "Rail" and count if it availble and it worked.
At the page 1, when I chose from checkbox and click to button Search Detail, it will load data that belong to the selected field that I ticked and show it in Page 2 but I dont know how to do it. Please help me to code in page 2
About the database, I want to explain :
table M_RAIL : rail_id, name, code
table M_STATION : station_id, name, code, rail_id
1 RAIL can have many STATION
1 STATION can have many RAIL
Please help me to sovle this problem. Thank so much |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|