This topic is locked

Syntax problem - dropdown search in listpage must find checkbox entrie

5/28/2008 2:43:51 PM
PHPRunner General questions
mikue from germany author

Hi @all
I would like to search with a dropdownbox on listpage for example Name 3

and I want to have a result of all records where cbox_c value=1 .

Searching with advanced search page, fixed links or building several views are not desired.

I always get an error message "parse error" or "there ist a failure in the near of '/option>"

in the section: //select values from database table klassifikation.

I can't figure out the right syntax for option value parameters.
phpr 4.0 build 265
Can anyone help me?
Greetings Michael
structure (main code) :
/ dd_search.php - outsourced, will be included in partner_list.php /
// create dropdown box klassifikation [ ! ]
$Vardd = "";

$Vardd.= "<select onchange=\"window.location.href=this.options[this.selectedIndex].value;\"><option value=\"\">Please select</option>";
$conn=db_connect();
//select values from database table klassifikation
$sql = "select `Klassifikation`, `Checkboxname` from `klassifikation`";

$res = db_query($sql,$conn);

while ($data = db_fetch_array($res))

$Vardd.="<option value=\"partner_list.php?a=search&value=1&SearchFor="."1"."&SearchOption=Equals&SearchField=.$data["Checkboxname"]\">".$data["Klassifikation"]."</option>";

$Vardd.="</select>";
/ partner_list.php /
include("include/dd_search.php");
$smarty->assign("dd_search_Klassifikation",$Vardd);
... code for checkboxes cbox_a to cbox_i, values NUll or 1
/ partner_list.htm /
{$dd_search_Klassifikation}
... code for checkboxes cbox_a to cbox_i, values NUll or 1
/ db table Klassifikation - only for lookup purpose /
ID, Klassifikation, Checkboxname

1, Name 1, cbox_a

2, Name 2, cbox_b

3, Name 3, cbox_c

4, Name 4, cbox_d

5, Name 5, cbox_e

6, Name 6, cbox_f

7, Name 7, cbox_g

8, Name 8, cbox_h

9, Name 9, cbox_i

J
Jane 5/29/2008

Hi,
It's difficult to tell you what's happening without seeing actual files.
First try to debug your code line by line.

For example here is an error inthe following snippet:

...

while ($data = db_fetch_array($res))

$Vardd.="<option value=\"partner_list.php?a=search&value=1&SearchFor=1&SearchOption=Equals&SearchField=".$data["Checkboxname"]."\">".$data["Klassifikation"]."</option>";

$Vardd.="</select>";

...

mikue from germany author 5/29/2008

Many thanks Jane, you're great!
Problem solved .. the correct code snippet is working fine now.
Greetings to support team from Michael