View Single Post
  #3  
Old 12-16-2008, 09:19 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: Data passing between template and PHP file

use event to submit the form
something like this->
<form method="post" action="mmy.php" name="mmysearchform">
<select name="year" style="width: 80%;" onchange="javascript:document.mmysearchform.submit ();">


Quote:
Originally Posted by AMMoyer
OK here's what I've come up with now. Still nothing. Can someone direct me to ways to troubleshoot this? I don't even know that the year is being posted to the PHP file.

from /skin/mmy.tpl
Code:
{capture name=menu} <form method="post" action="mmy.php" name="mmysearchform"> <select name="year" style="width: 80%;"> <option value="" selected="selected">Select Year</option> <option value="2009">2009 <option value="2008">2008 <option value="2007">2007 <option value="2006">2006 <option value="2005">2005 <option value="2004">2004 </select><br> {section name=i loop=$makeid} {$makeid[i].make_name}&lt;br&gt; {/section} <form method="post" action="mmy.php" name="year"> <select name="posted_data[makeid]" style="width: 80%;"> <option value="" selected="selected">Select Make</option> </select><br> <form method="post" action="mmy.php" name="mmysearchform"> <select name="posted_data[modelid]" style="width: 80%;"> <option value="" selected="selected">Select Model</option> </select> <font class="CategoriesList"><a href="home.php?cat=" class="VertMenuItems"></a></font><br /> <font class="CategoriesList"><a href="home.php?cat=" class="VertMenuItems"></a></font><br /> {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_mmy_search menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding}

from main xcart folder:
Code:
$year = $_POST['year']; ///////////////////////////////////////////////// make query for dropdown $query = sprintf("SELECT DISTINCT makeid, makename FROM iemmy WHERE yearid='$year'"); $result = @mysql_query($query); $rowMake = mysql_fetch_array($result); ///////////////////////////////////////////////// if (mysql_num_rows ($result) &gt;= 1) { $makeid = array(); while ($rows = mysql_fetch_array ($result, MYSQL_ASSOC)) array_push ($makeid, $rows); $smart-&gt;assign ("makeid", $makeid); }

Are the file locations correct? Am I missing some sort of include? Any help is greatly appreciated. Thanks.

Adam
Reply With Quote