search intr o baza de date !
Last Updated: Jan 04 2007 22:24, Started by
florinsss
, Jan 04 2007 22:24
·
0
#1
Posted 04 January 2007 - 22:24
sal all ! si La Multi Ani !
iata problema mea de incepator php ! vreau sa fac o sectiune de search si am scris codul urmator ! <?php include("db.php"); ?> <script> function func() { //alert("ppp"); str="<?php echo $PHP_SELF; ?>?fcatid="+document.search.fcatid.value+"&catid=<?php echo $catid; ?>&subcatid=<?php echo $subcatid; ?>"; //alert(str); window.location=str; } </script> <FORM NAME="search" ACTION=" <?php echo("$PHP_SELF?subcatid=$subcatid&catid=$catid&fcatid=$fcatid&where=$where") ?>" METHOD=POST> <font color="#335588">By Category:</font> <SELECT NAME="fcatid" SIZE=1 onchange="func();"> <OPTION SELECTED VALUE=""> <?php if($fcatid > 0) {$fcatid=$ffcat ; } ?> <?php if( (isset($fcatid)) and ($fcatid!=10) and ($fcatid>0)) { $categ = mysql_query("SELECT catid, name FROM categories where catid=$fcatid"); $cat = mysql_fetch_array($categ); $fcatid = $cat["catid"]; $name = $cat["name"]; echo("$name"); echo("<OPTION VALUE=10>Any Category\n"); } else { echo("Any Category"); $fcatid = 10; } $categ = mysql_query("SELECT catid, name FROM categories where catid!=$fcatid"); while ($cat = mysql_fetch_array($categ)) { $fcatid = $cat["catid"]; $name = $cat["name"]; echo("<OPTION VALUE='$fcatid'>$name\n"); } if( (isset($ffcat)) and ( $ffcat>0) and ($ffcat!=10) ) { $subcateg = mysql_query("SELECT subcatid, sname FROM subcat where scatid = $ffcat")or die(mysql_error()); $where = " where cat = $ffcat and public>$public"; ?> </SELECT><BR> <font color="#335588">By Subcategory:</font> <SELECT NAME="fscatid" SIZE=1> <OPTION SELECTED VALUE="">Any Subcategory <?php while ($scat = mysql_fetch_array($subcateg) ) { $fscatid = $scat["subcatid"]; $sname = $scat["sname"]; echo("<OPTION VALUE='$fscatid'>$sname\n"); } } ?> </SELECT><BR><font color="#335588"> Containing Text: </font><INPUT TYPE=TEXT NAME="searchtext" size="19"> |
Anunturi
Bun venit pe Forumul Softpedia!
▶ 0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users