Code: Select all
echo "hello world";
echo $_GET['b'];
This is a Printr dump:
Code: Select all
[i]Array
(
[c] => 244
[b] => Array
(
[subcategories_also] => 1
[classified_auction_search] => 0
[search_titles] => 1
[whole_word] => 0
[by_zip_code] =>
[by_zip_code_distance] =>
[search] => Search
[search_text] =>
[optional_field_2] => yes
[question_value] => Array
(
[119] =>
)
)
[a] => 19
[change] => 0
)
[/i]
Full code for function follows:
Code: Select all
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function displaySearchQuestions
($categoryID)
{ if ($this->debug_ajax)
{
echo "<br>TOP OF DISPLAYSEARCHQUESTIONS<BR>\n";
}
$category =
$this->getCategoryQuestions($categoryID);
$to_display = 0;
$criteria = "
<table cellpadding=2 cellspacing=1 border=0
width=\"100%\">";
// Display all optional fields
$this->page_id = 44;
$this->get_text();
$this->get_category_configuration($categoryID);
$this-
>get_site_configuration();
$this->get_ad_configuration();
if(!$this-
>optional_fields)
$this->CountOptionalFields();
$field_vars =
get_object_vars($this->category_configuration);
$ad_vars = get_object_vars($this-
>ad_configuration_data);
if ($i>1)
{
// the
following is impossible to make sense of
//if($field_vars
['USE_OPTIONAL_FIELD_'.$i])
if (($field_vars['USE_OPTIONAL_FIELD_'.$i]) &&
(!$this->db->get_site_setting("optional_".$i."_filter_association")))
{
// Special case because optional field 1 has a different number than rest of
scheme
if($i == 1)
$criteria
.="<tr>\n\t<td class=search_field_section_labels style='width:40%;'>".urldecode($this->messages
[1457])."</td>\n\t";
elseif($i <= 10)
$criteria .="<tr>\n\t<td class=search_field_section_labels style='width:40%;'>".urldecode($this
->messages[(1458+($i-1))])."</td>\n\t";
elseif($i <= 20)
$criteria .="<tr>\n\t<td class=search_field_section_labels
style='width:40%;'>".urldecode($this->messages[(1933+($i-11))])."</td>\n\t";
elseif($i <= 35)
$criteria .="<tr>\n\t<td
class=search_field_section_labels style='width:40%;'>".urldecode($this->messages[(2778+($i-
21))])."</td>\n\t";
$criteria .="<td class=search_data_values>\n\t";
if ($ad_vars["OPTIONAL_".$i."_NUMBER_ONLY"])
{
//if numbers only - produce a upper and lower limit
$criteria .= "<table cellpadding=1 >
<tr class=range_labels><td>".urldecode($this->messages[1440])."</td><td><input name=b
[by_optional_".$i."_lower] size=15 maxsize=15 class=range_labels>\n\t\t</td></tr>
<tr class=range_labels><td>".urldecode($this->messages
[1441])."</td><td><input name=b[by_optional_".$i."_higher] size=15 maxsize=15
class=range_labels>\n\t\t</td></tr></table>";
}
elseif (!($ad_vars["OPTIONAL_".$i."_FIELD_TYPE"]))
{
//check to see if numbers only
if ($ad_vars
["OPTIONAL_".$i."_NUMBER_ONLY"])
{
//if numbers only - produce a upper and lower limit
$criteria .= "<table cellpadding=1 >
<tr
class=range_labels><td>".urldecode($this->messages[1440])."</td><td><input name=b
[by_optional_".$i."_lower] size=15 maxsize=15 class=search_data_values>\n\t\t</td></tr>
<tr class=range_labels><td>".urldecode($this->messages
[1441])."</td><td><input name=b[by_optional_".$i."_higher] size=15 maxsize=15
class=search_data_values>\n\t\t</td></tr></table>";
}
else
$criteria .= "<input
type=text name=b[optional_field_".$i."] id=optional_field_".$i." class=search_data_values>\n\t";
}
else
{
$query = "select * from geodesic_classifieds_sell_question_choices where
type_id = ".$ad_vars["OPTIONAL_".$i."_FIELD_TYPE"]." order by display_order,value";
if ($this->debug_ajax) echo $query."<Br>\n";
$type_result = $this->db->Execute($query) or die();
if
($type_result->RecordCount() > 0)
{
$criteria .= "<select name=b[optional_field_".$i."] id=optional_field_".$i."
class=search_data_values>";
$criteria .= "<option
value=0></option>";
$matched = 0;
while ($show_dropdown = $type_result->FetchRow())
{
$criteria .= "<option
value=\"".$show_dropdown['value']."\" ";
if ($this->classified_variables["optional_field_".$i] == $show_dropdown['value'])
{
$criteria .= "selected";
$matched
= 1;
}
$criteria .= ">".$show_dropdown['value']."</option>\n\t\t";
}
$criteria .= "</select>";
}
else
//blank text box
$criteria .= "<input type=text name=b
[optional_field_".$i."] id=optional_field_".$i." class=search_data_values>\n\t";
}
if (($ad_vars["OPTIONAL_".$i."_OTHER_BOX"]) &&
($ad_vars["OPTIONAL_".$i."_FIELD_TYPE"]))
$criteria .= "
".urldecode($this->messages[1458])." <input type=text name=b[optional_field_".$i."_other]
class=search_data_values>\n\t";
$criteria .="</td>\n</tr>\n";
$to_display++;
}
elseif ($this->db-
>get_site_setting("optional_".$i."_filter_association"))
{
//replace this
//$criteria .= "associated with filter";
}
}
//spit out the questions
if(is_array
($category))
{
foreach ($category["questions"] as $key =>
$value)
{
//get the list of choices for this
question
if ($category["choices"][$key] == "check")
{
$criteria .= "
<span
class=search_field_section_labels style='width:10%;'>".$category["questions"][$key]."</span>
<input class=search_data_values type=checkbox name=b[question_value][".$key."]
value=\"".$category["questions"][$key]."\">
";
$to_display++;
}
elseif ($category
["choices"][$key] == "none")
{
$criteria .= "
<tr>
<td class=search_field_section_labels style='width:40%;'>".$category
["questions"][$key]."</td>
<td
class=search_data_values>
<input class=search_data_values type=text name=b[question_value][".$key."] />
</td>
</tr>";
$to_display++;
}
elseif ($category["choices"][$key] == "url")
{
$criteria .= "
<tr>
<td class=search_field_section_labels
style='width:40%;'>".$category["questions"][$key]."</td>
<td class=search_data_values>
<input type=text name=b[question_value][".$key."] />
</td>
</tr>";
$to_display++;
}
elseif
($category["choices"][$key] == "textarea")
{
//FOR THE SEARCH FORM ALL TEXT AREA BOXES ARE TO DISLPAYED AS REGULAR TEXT BOXES
$criteria .= "
<span class=search_field_section_labels
style='width:40%;'>".$category["questions"][$key]."</span>
<span class=search_data_values>
<input type=text name=b[question_value][".$key."] />
</span>
";
$to_display++;
}
elseif
($category["choices"][$key] != "none")
{
$query = "select * from geodesic_classifieds_sell_question_choices where type_id = '{$category
["choices"][$key]}' order by display_order,value";
if
($this->debug_ajax) echo $query."<Br>\n";
$result = $this
->db->Execute($query) or die("An error has occurred ".__LINE__);
if ($result->RecordCount() > 0)
{
$criteria .= "
{$category["questions"][$key]}
<select
name=b[question_value][$key] class=search_data_values>
<option></option>";
while
($row = $result->FetchRow())
echo "hello world";
echo $_GET['b'];
if($_GET['b']['question_value'][$key]==$row["value"]){$criteria .="<option selected>{$row
["value"]}</option>";}
else{
$criteria .= "
<option>{$row["value"]}</option>";
} $criteria .= "
</select>
";
$to_display++;
}
}
}
}
$criteria .= "
</table>";
//set header for charset, otherwise questions don't show up right for
weird charsets..
$charset = geoString::getCharsetTo();
if (!$charset){
//if not using charsetTo, then use the charsetclean setting.
$charset
= geoString::getCharset();
}
header('Content-Type:
application/x-javascript; charset='.$charset);
echo ($to_display == 0) ?
" |catQuestions" : "$criteria|catQuestions";
exit;
}
//%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Any help appreciated