[TYPO3-dev] search form looses id

Robert Wildling robertwildling at gmail.com
Sat May 26 21:11:53 CEST 2012


Hi,

I really beg for your help!!!

An ext generates a form like this.

...
	function main($content, $conf) {
		$this->conf = $conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		
		// Database tables
		$categoryTable = 'pages';
		$categoryPid = 3;
		$provincesTable = "static_country_zones";
		$provincesArea = 'zn_country_iso_2="AT"';
		
		$manufacturerPid = 10;
		$searchResultPagePid = 89;
		
		// Link generation for the action attribute of the form tag
		$searchResultPageLink = $this->pi_getPageLink($searchResultPagePid);
		
		// Generate the search form - 1.: Categories
		$content .= '<form action="' . $searchResultPageLink . '" method="GET">';
		$content .= '<select name="category" id="selectCat">';
		
		// Get first level of the categories
		$selectManufacturers = 
$GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$categoryTable,'pid='.$categoryPid,'','','');
		$numManufacturers = 
$GLOBALS['TYPO3_DB']->sql_num_rows($selectManufacturers);
		
		$i = 0;
		while ($res = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($selectManufacturers))
		{
			$content .= '<option value="' . $res['uid'] .'"';
			
			// if category is set, set the chosen record to selected
			if((t3lib_div::_GET('category') != '') && 
(t3lib_div::_GET('category') != 'divider') && 
(t3lib_div::_GET('category') == $res['uid'])) {
				$content .= " selected='selected'";
			}
			$content .= '>' . $res['title'] . '</option>';
			
			// Get second level of the categories
			$sel = 
$GLOBALS['TYPO3_DB']->exec_SELECTquery('*',$categoryTable,'pid='.$res['uid'],'','','');
			while ($res2 = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($sel)) {
				$content .= '<option value="' . $res2['uid'] . '"';
				
				if((t3lib_div::_GET('category') != '') && 
(t3lib_div::_GET('category') != 'divider') && 
(t3lib_div::_GET('category') == $res2['uid'])) {
					$content .= " selected='selected'";
				}
				$content .= '>- ' . $res2['title'] . '</option>';
			}
			
			$i++;
		}
		$content .= '</select>';

... (2nd select box)

		// Search Button
		$content .= '<input type="submit" value="' . 
$this->pi_getLL('submit_button_label') . '" />';

		// close form tag
		$content .= "</form>";
		$content .= '</div>';

		return $content;
	}


After clicking on the search button, the id, which is saved in 
$searchResultPagePid and correctly generated as a link in 
$searchResultPageLink, gets "lost", while the parameters (category=xy) 
are part of the URL.

What am I doing wrong here?
config {
   linkVars = L, print
   uniqueLinkVars = 1
}

is set ...

Any ideas? Please!

Thank you very much!
Robert



More information about the TYPO3-dev mailing list