Neptunus Maris
Members-
Posts
192 -
Joined
-
Last visited
Never
Everything posted by Neptunus Maris
-
Pagination...with my search engine
Neptunus Maris replied to Neptunus Maris's topic in PHP Coding Help
Ok thanks...but can you help me with this pagination crisis? -
Pagination...with my search engine
Neptunus Maris replied to Neptunus Maris's topic in PHP Coding Help
Would sessions work with this? thats what ive been trying -
Hi guys I've built an advanced search engine with pagination. First: I did use all the tutorials on this site for pagination. Second: I did use all other resources. Here is the site: http://devel.ecountrylifestyle.com/green_thumb_gardener/resources/facilities.php?fac=A Here is the last update of the code: <?php //connect include('../../includes/PHP/globals_db.inc'); $dbconn = mysql_connect($ecl_database_server, $ecl_username, $ecl_password) or die(mysql_error()); $select = mysql_select_db($ecl_database, $dbconn) or die(mysql_error()); //------------ //first lets make an array of letters A-Z $alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z"); $links_top = ""; foreach ($alpha as $links) { $links_top .= "<a class = \"checklist\" href = 'facilities.php?fac=$links'>"; if ($links == "Z") { $links_top .= "$links</a>"; } else { $links_top .= "$links</a> | "; } //end if } //end if //type array $fac_type = array("Type of Facility" => "None", "Arboretum" => "A", "Arboretum/Garden" => "A, G", "Garden" => "G", "Garden/Arboretum" => "G, A", "Park" => "P", "Park/Garden" => "P, G", "Garden/Park" => "G, P", "Conservatory" => "C"); //states $fac_state = array("State Select" => "State", "Alabama" => "AL", "Alaska" => "AL", "Arizona" => "AZ", "Arkansas" => "AK", "California" => "CA", "Colorado" => "CO", "Connecticut" => "CT", "Delaware" => "DE", "Dist of Columbia" => "DC", "Florida" => "FL", "Georgia" => "GA", "Hawaii" => "HI", "Idaho" => "ID", "Illinois" => "IL", "Indiana" => "IN", "Iowa" => "IA", "Kansas" => "KS", "Kentucky" => "KY", "Louisiana" => "LA", "Maine" => "ME", "Maryland" => "MD", "Massachusetts" => "MA", "Michigan" => "MI", "Minnesota" => "MN", "Mississippi" => "MS", "Missouri" => "MO", "Montana" => "MT", "Nebraska" => "NE", "Nevada" => "NV", "New Hampshire" => "NH", "New Jersey" => "NJ", "New Mexico" => "NM", "New York" => "NY", "North Carolina" => "NC", "North Dakota" => "ND", "Ohio" => "OH", "Oklahoma" => "OK", "Oregon" => "OR", "Pennsylvania" => "PA", "Rhode Island" => "RI", "South Carolina" => "SC", "South Dakota" => "SD", "Tennessee" => "TN", "Texas" => "TX", "Utah" => "UT", "Vermont" => "VT", "Virginia" => "VA", "Washington" => "WA", "West Virginia" => "WV", "Wisconsin" => "WI", "Wyoming" => "WY"); if (!isset($_GET )) { $page = 1; } else { $page = $_GET ; } //end if $max_results = 10; $from = (($page * $max_results) - $max_results); if (isset($_POST[submit])) { session_destroy(); //start the query statement for the search fields-starting with key word for default $query = "SELECT * FROM pub_gardens WHERE"; $end_query = ""; //if the user selects a type of facility from drop down menu, add on to the query string //also make sure the first value of the drop down for the facility selection isnt the first $key_word = $_POST[key_word]; $type = $_POST[type]; $state = $_POST[state]; $city = $_POST[city]; $zip = $_POST[zip]; if ($key_word != "") { $query .= " facility LIKE '%$key_word%'"; $end_query .= " facility LIKE '%$key_word%'"; } //end if if (($city == "City" || $city == "")) { $city = ""; } //end if if (($zip == "Zip Code" || $zip == "")) { $zip = ""; } //end if if ($type != "None") { if ($key_word == "") { $query .= " type = '$type'"; $end_query .= " type = '$type'"; } else { $query .= " OR type = '$type'"; $end_query .= " OR type = '$type'"; } //end if } //end if //if the user selects a state from drop down menu, add on to the query string //also make sure the first value of the drop down for the state selection isnt the first if ($state != "State") { if (($key_word == "" && $type == "None")) { $query .= " state = '$state'"; $end_query .= " state = '$state'"; } else { $query .= " OR state = '$state'"; $end_query .= " OR state = '$state'"; } //end if } //end if //if the user types in a city in the city field from the form, add on to the query string if ($city != "") { if (($key_word == "" && $type == "None" && $state == "State")) { $query .= " city LIKE '%$city'"; $end_query .= " city LIKE '%$city'"; } else { $query .= " OR city LIKE '%$city'"; $end_query .= " OR city LIKE '%$city'"; } //end if } //end if //if the user types in a zip code in the zip field from the form, add on to the query string if ($zip != "") { if (($key_word == "" && $type == "None" && $state == "State" && $city == "")) { $query .= " zip LIKE '%$zip'"; $end_query .= " zip LIKE '%$zip'"; } else { $query .= " OR zip LIKE '%$zip'"; $end_query .= " OR zip LIKE '%$zip'"; } //end if } //end if //add on last addition to the $query string variable $query .= " ORDER BY facility LIMIT $from, $max_results"; $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //set session variables session_start(); $_SESSION['form_type'] = $type; $_SESSION['form_state'] = $state; $_SESSION['form_city'] = $city; $_SESSION['form_zip'] = $zip; $_SESSION['form_key_word'] = $key_word; //query session $_SESSION['end_query'] = $end_query; $_SESSION['query'] = $query; print_r($_SESSION); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; // Figure out the total number of results in DB: $t_query = "SELECT COUNT(*) as Num FROM pub_gardens WHERE"; $_SESSION['t_query'] = $t_query . $end_query; //result $t_result = mysql_query($t_query . $end_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if /* //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach */ foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($type == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach /* //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach */ foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($state == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if } else { //add on last addition to the $query string variable $query = $_SESSION['query']; $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; $t_query = $_SESSION['t_query']; $t_result = mysql_query($t_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($_SESSION['form_type'] == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($_SESSION['form_state'] == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>eCountryLifestyle: Public Garden Directory</title> <link href="../../_css/style_popup.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="layoutContainer"> <div id="headerHome"><img src="../images/public_garden_directory_banner.jpg" alt="Public Garden Directory" width="784" height="182" /></div> <div id="contentLayout"> <div id="searchLayoutChecklist"> <div class="topLinkTextNormalHeading" >Browse by Facility Name: <span class="topLinkTextNormal"><?php print "$links_top"; ?></span></div> </div> <div id="content"> <div id="contents"> <div id="sidebarLayout"> <p align="center"><a href="http://www.cotton.org/index.cfm" target="_blank"><img src="../images/associations/national_cotton_counsel.jpg" alt="National Cotton Counsil" width="180" height="90" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.mulchandsoilcouncil.org/index.html" target="_blank"><img src="../images/associations/mulch_and_soil_counsl.jpg" alt="Mulch and Soil Council" width="180" height="157" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.bluediamond.com/" target="_blank"><img src="../images/associations/blue_diamond_almonds.jpg" alt="Blue Diamonds Almonds" width="180" height="127" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.naturalproductsassoc.org/site/PageServer" target="_blank"><img src="../images/associations/natural_pro_assocn.jpg" alt="National Products Association" width="180" height="82" border="0" /></a></p> </div> <h1 class="subtitle">Public Garden Directory<br /> <br /> </h1> <?php print "$display"; ?><br><br> <table width="525" border="0" cellpadding="2" cellspacing="0" class="table_box"> <tr> <td class="table_row_header1"><strong>Search</strong></td> </tr> <tr> <td class="table_main_content"> <form class = "form1" action = "advanced_search.php" method = "post"> <table border = 0> <tr> <td colspan = 2><select name = "type"><?php echo "$type_option"; ?></select></td> </tr> <tr> <td height = 30 colspan = 2 valign = "bottom"><select name = "state"><?php echo "$state_option"; ?></select></td> </tr> <tr> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "zip" size = 6 maxlength = 12 value = "<?=$_SESSION[form_zip];?>"></td> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "city" size = 10 maxlength = 30 value = "<?=$_SESSION[form_city];?>"></td> </tr> <tr> <td colspan = 2 valign = "bottom">Key Word(s):</td> </tr> <tr> <td><input class = "form1" type = "text" name = "key_word" size = 20 maxlength = 100 value = "<?=$_SESSION[form_key_word];?>"></td> <td><input class = "button" type = "submit" name = "submit" value = "Search"></td> </tr> </table> </form> </td> </tr> </table> <p> </p> </div> </div> </div> </div> </body> </html> I've tried everything possible to get the pagination part working...please help
-
ok do you know how to covert wmv files to flash as they are uploaded?
-
Am I doing this right??? <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="250" height="200" id="player" align="middle"> <param name="allowFlashAutoInstall" value="true" /> <param name="Flashvars" value="file=http://$_SERVER[sERVER_NAME]/webinar_previews/videos/$row[link]&autoStart=false" /> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="flvplayer.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <embed src="flvplayer.swf" swliveconnect="true" showcontrols="1" flashvars="file=$_SERVER[sERVER_NAME]/webinar_previews/videos/$row[link]&autoStart=false" quality="high" bgcolor="#ffffff" width="290" height="225" name="player" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> The video doesnt seem to play.
-
or doe I use the exec() function only for this?
-
I've seen stuff like this: <?php shell_exec("/usr/local/bin/ffmpeg -i ". $src ." -acodec mp3 -ab 56 -ar 22050 -f flv -s 320x240 -aspect 4:3 ". $dest); shell_exec("rm -rf ". $src); ?> is this the right direction?
-
Does anybody know how to convert other video formats to flash as they/after they are uploaded? I saw something at a glance using these functions: shell_exec(); exec(); The conversion code is written in those functions. -Neptune
-
Still no one?
-
Here is an update of the code that I've just tried testing again. <?php //connect include('../../includes/PHP/globals_db.inc'); $dbconn = mysql_connect($ecl_database_server, $ecl_username, $ecl_password) or die(mysql_error()); $select = mysql_select_db($ecl_database, $dbconn) or die(mysql_error()); //------------ //first lets make an array of letters A-Z $alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z"); $links_top = ""; foreach ($alpha as $links) { $links_top .= "<a class = \"checklist\" href = 'facilities.php?fac=$links'>"; if ($links == "Z") { $links_top .= "$links</a>"; } else { $links_top .= "$links</a> | "; } //end if } //end if if (!isset($_GET )) { $page = 1; } else { $page = $_GET ; } //end if $max_results = 10; $from = (($page * $max_results) - $max_results); if (isset($_POST[submit])) { session_destroy(); //start the query statement for the search fields-starting with key word for default $query = "SELECT * FROM pub_gardens WHERE facility LIKE '%$_POST[key_word]%'"; //if the user selects a type of facility from drop down menu, add on to the query string //also make sure the first value of the drop down for the facility selection isnt the first if ($_POST[type] != "Type of Facility") { $query .= " OR type = '$_POST[type]'"; } //end if //if the user selects a state from drop down menu, add on to the query string //also make sure the first value of the drop down for the state selection isnt the first if ($_POST[state] != "State") { $query .= " OR state = '$_POST[state]'"; } //end if //if the user types in a city in the city field from the form, add on to the query string if (($_POST[city] != "" && $_POST[city] != "City")) { $query .= " OR city LIKE '%$_POST[city]'"; } //end if //if the user types in a zip code in the zip field from the form, add on to the query string if (($_POST[zip] != "" && $_POST[zip] != "Zip Code")) { //make sure the default value isnt "Zip" before adding on to the string $query .= " OR zip LIKE '%$_POST[zip]'"; } //end if //add on last addition to the $query string variable $query .= " ORDER BY facility LIMIT $from, $max_results"; //set session variables session_start(); $_SESSION['form_type'] = $_POST[type]; $_SESSION['form_state'] = $_POST[state]; $_SESSION['form_city'] = $_POST[city]; $_SESSION['form_zip'] = $_POST[zip]; $_SESSION['form_key_word'] = $_POST[key_word]; //query session $_SESSION['query'] = $query; } else { $query = $_SESSION['query']; } //end if $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; // Figure out the total number of results in DB: $t_query = "SELECT COUNT(*) as Num FROM pub_gardens WHERE facility LIKE '%".$_SESSION['form_key_word']."%'"; $t_query .= " OR type = '".$_SESSION['form_type']."'"; $t_query .= " OR state = '".$_SESSION['form_state']."'"; $t_query .= " OR city LIKE '%".$_SESSION['form_city']."'"; $t_query .= " OR zip LIKE '%".$_SESSION['form_zip']."'"; //result $t_result = mysql_query($t_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if //type array $fac_type = array("Type of Facility" => "None", "Arboretum" => "A", "Arboretum/Garden" => "A, G", "Garden" => "G", "Garden/Arboretum" => "G, A", "Park" => "P", "Park/Garden" => "P, G", "Garden/Park" => "G, P", "Conservatory" => "C"); //states $fac_state = array("State Select" => "State", "Alabama" => "AL", "Alaska" => "AL", "Arizona" => "AZ", "Arkansas" => "AK", "California" => "CA", "Colorado" => "CO", "Connecticut" => "CT", "Delaware" => "DE", "Dist of Columbia" => "DC", "Florida" => "FL", "Georgia" => "GA", "Hawaii" => "HI", "Idaho" => "ID", "Illinois" => "IL", "Indiana" => "IN", "Iowa" => "IA", "Kansas" => "KS", "Kentucky" => "KY", "Louisiana" => "LA", "Maine" => "ME", "Maryland" => "MD", "Massachusetts" => "MA", "Michigan" => "MI", "Minnesota" => "MN", "Mississippi" => "MS", "Missouri" => "MO", "Montana" => "MT", "Nebraska" => "NE", "Nevada" => "NV", "New Hampshire" => "NH", "New Jersey" => "NJ", "New Mexico" => "NM", "New York" => "NY", "North Carolina" => "NC", "North Dakota" => "ND", "Ohio" => "OH", "Oklahoma" => "OK", "Oregon" => "OR", "Pennsylvania" => "PA", "Rhode Island" => "RI", "South Carolina" => "SC", "South Dakota" => "SD", "Tennessee" => "TN", "Texas" => "TX", "Utah" => "UT", "Vermont" => "VT", "Virginia" => "VA", "Washington" => "WA", "West Virginia" => "WV", "Wisconsin" => "WI", "Wyoming" => "WY"); /* //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach */ foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($_SESSION['form_type'] == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach /* //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach */ foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($_POST['form_type'] == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if } //end foreach ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>eCountryLifestyle: Public Garden Directory</title> <link href="../../_css/style_popup.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="layoutContainer"> <div id="headerHome"><img src="../images/public_garden_directory_banner.jpg" alt="Public Garden Directory" width="784" height="182" /></div> <div id="contentLayout"> <div id="searchLayoutChecklist"> <div class="topLinkTextNormalHeading" >Browse by Facility Name: <span class="topLinkTextNormal"><?php print "$links_top"; ?></span></div> </div> <div id="content"> <div id="contents"> <div id="sidebarLayout"> <p align="center"><a href="http://www.cotton.org/index.cfm" target="_blank"><img src="../images/associations/national_cotton_counsel.jpg" alt="National Cotton Counsil" width="180" height="90" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.mulchandsoilcouncil.org/index.html" target="_blank"><img src="../images/associations/mulch_and_soil_counsl.jpg" alt="Mulch and Soil Council" width="180" height="157" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.bluediamond.com/" target="_blank"><img src="../images/associations/blue_diamond_almonds.jpg" alt="Blue Diamonds Almonds" width="180" height="127" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.naturalproductsassoc.org/site/PageServer" target="_blank"><img src="../images/associations/natural_pro_assocn.jpg" alt="National Products Association" width="180" height="82" border="0" /></a></p> </div> <h1 class="subtitle">Public Garden Directory<br /> <br /> </h1> <?php print "$display"; ?><br><br> <table width="525" border="0" cellpadding="2" cellspacing="0" class="table_box"> <tr> <td class="table_row_header1"><strong>Search</strong></td> </tr> <tr> <td class="table_main_content"> <form class = "form1" action = "advanced_search.php" method = "post"> <table border = 0> <tr> <td colspan = 2><select name = "type"><?php echo "$type_option"; ?></select></td> </tr> <tr> <td height = 30 colspan = 2 valign = "bottom"><select name = "state"><?php echo "$state_option"; ?></select></td> </tr> <tr> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "zip" size = 6 maxlength = 12 value = "<?=$_SESSION[form_zip];?>"></td> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "city" size = 10 maxlength = 30 value = "<?=$_SESSION[form_city];?>"></td> </tr> <tr> <td colspan = 2 valign = "bottom">Key Word(s):</td> </tr> <tr> <td><input class = "form1" type = "text" name = "key_word" size = 20 maxlength = 100 value = "<?=$_SESSION[key_word];?>"></td> <td><input type = "submit" name = "submit" value = "Search" width = 120></td> </tr> </table> </form> </td> </tr> </table> <p> </p> </div> </div> </div> </div> </body> </html>
-
I can't figure this out...I need help, please
-
Does anybody have experience with coding an advanced search? Like with using multiple fields for the search. Here is my most updated code now the page goes blank when I do a search...I sort of got help last time, but no: Also here is the page that the search menu is on: http://devel.ecountrylifestyle.com/green_thumb_gardener/resources/facilities.php?fac=A <?php //connect include('../../includes/PHP/globals_db.inc'); $dbconn = mysql_connect($ecl_database_server, $ecl_username, $ecl_password) or die(mysql_error()); $select = mysql_select_db($ecl_database, $dbconn) or die(mysql_error()); //------------ //first lets make an array of letters A-Z $alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z"); $links_top = ""; foreach ($alpha as $links) { $links_top .= "<a class = \"checklist\" href = 'facilities.php?fac=$links'>"; if ($links == "Z") { $links_top .= "$links</a>"; } else { $links_top .= "$links</a> | "; } //end if } //end if if (!isset($_GET )) { $page = 1; } else { $page = $_GET ; } //end if $max_results = 10; $from = ($page * $max_results); if (isset($_POST[submit])) { session_destroy(); //start the query statement for the search fields-starting with key word for default $query = "SELECT * FROM pub_gardens WHERE facility LIKE '%$_POST[key_word]%'"; //if the user selects a type of facility from drop down menu, add on to the query string //also make sure the first value of the drop down for the facility selection isnt the first if ($_POST[type] != "Type of Facility") { $query .= " OR type = '$_POST[type]'"; } //end if //if the user selects a state from drop down menu, add on to the query string //also make sure the first value of the drop down for the state selection isnt the first if ($_POST[state] != "State") { $query .= " OR state = '$_POST[state]'"; } //end if //if the user types in a city in the city field from the form, add on to the query string if ($_POST[city] != "") { //make sure the default value isnt "City" before adding on to the string if ($_POST[city] != "City") { $query .= " OR city LIKE '%$_POST[city]'"; } //end if } //end if //if the user types in a zip code in the zip field from the form, add on to the query string if ($_POST[zip] != "Zip Code") { //make sure the default value isnt "Zip" before adding on to the string $query .= " OR zip LIKE '%$_POST[zip]'"; } //end if //add on last addition to the $query string variable $query .= " ORDER BY facility LIMIT $from, $max_results"; //set session variables session_start(); $_SESSION['form_type'] = $_POST[type]; $_SESSION['form_state'] = $_POST[state]; $_SESSION['form_city'] = $_POST[city]; $_SESSION['form_zip'] = $_POST[zip]; $_SESSION['form_key_word'] = $_POST[key_word]; //query session $_SESSION['query'] = $query; } else { $query = $_SESSION['query']; } //end if $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; // Figure out the total number of results in DB: $t_query = "SELECT COUNT(*) as Num FROM pub_gardens WHERE facility LIKE '%".$_SESSION['form_key_word']."%'"; $t_query .= " OR type = '".$_SESSION['form_type']."'"; $t_query .= " OR state = '".$_SESSION['form_state']."'"; $t_query .= " OR city LIKE '%".$_SESSION['form_city']."'"; $t_query .= " OR zip LIKE '%".$_SESSION['form_zip']."'"; //result $t_result = mysql_query($t_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if //type array $fac_type = array("Type of Facility" => "None", "Arboretum" => "A", "Arboretum/Garden" => "A, G", "Garden" => "G", "Garden/Arboretum" => "G, A", "Park" => "P", "Park/Garden" => "P, G", "Garden/Park" => "G, P", "Conservatory" => "C"); //states $fac_state = array("State Select" => "State", "Alabama" => "AL", "Alaska" => "AL", "Arizona" => "AZ", "Arkansas" => "AK", "California" => "CA", "Colorado" => "CO", "Connecticut" => "CT", "Delaware" => "DE", "Dist of Columbia" => "DC", "Florida" => "FL", "Georgia" => "GA", "Hawaii" => "HI", "Idaho" => "ID", "Illinois" => "IL", "Indiana" => "IN", "Iowa" => "IA", "Kansas" => "KS", "Kentucky" => "KY", "Louisiana" => "LA", "Maine" => "ME", "Maryland" => "MD", "Massachusetts" => "MA", "Michigan" => "MI", "Minnesota" => "MN", "Mississippi" => "MS", "Missouri" => "MO", "Montana" => "MT", "Nebraska" => "NE", "Nevada" => "NV", "New Hampshire" => "NH", "New Jersey" => "NJ", "New Mexico" => "NM", "New York" => "NY", "North Carolina" => "NC", "North Dakota" => "ND", "Ohio" => "OH", "Oklahoma" => "OK", "Oregon" => "OR", "Pennsylvania" => "PA", "Rhode Island" => "RI", "South Carolina" => "SC", "South Dakota" => "SD", "Tennessee" => "TN", "Texas" => "TX", "Utah" => "UT", "Vermont" => "VT", "Virginia" => "VA", "Washington" => "WA", "West Virginia" => "WV", "Wisconsin" => "WI", "Wyoming" => "WY"); /* //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach */ foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($_SESSION['form_type'] == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach /* //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach */ foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($_POST['form_type'] == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if } //end foreach ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>eCountryLifestyle: Public Garden Directory</title> <link href="../../_css/style_popup.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="layoutContainer"> <div id="headerHome"><img src="../images/public_garden_directory_banner.jpg" alt="Public Garden Directory" width="784" height="182" /></div> <div id="contentLayout"> <div id="searchLayoutChecklist"> <div class="topLinkTextNormalHeading" >Browse by Facility Name: <span class="topLinkTextNormal"><?php print "$links_top"; ?></span></div> </div> <div id="content"> <div id="contents"> <div id="sidebarLayout"> <p align="center"><a href="http://www.cotton.org/index.cfm" target="_blank"><img src="../images/associations/national_cotton_counsel.jpg" alt="National Cotton Counsil" width="180" height="90" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.mulchandsoilcouncil.org/index.html" target="_blank"><img src="../images/associations/mulch_and_soil_counsl.jpg" alt="Mulch and Soil Council" width="180" height="157" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.bluediamond.com/" target="_blank"><img src="../images/associations/blue_diamond_almonds.jpg" alt="Blue Diamonds Almonds" width="180" height="127" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.naturalproductsassoc.org/site/PageServer" target="_blank"><img src="../images/associations/natural_pro_assocn.jpg" alt="National Products Association" width="180" height="82" border="0" /></a></p> </div> <h1 class="subtitle">Public Garden Directory<br /> <br /> </h1> <?php print "$display"; ?><br><br> <table width="525" border="0" cellpadding="2" cellspacing="0" class="table_box"> <tr> <td class="table_row_header1"><strong>Search</strong></td> </tr> <tr> <td class="table_main_content"> <form class = "form1" action = "advanced_search.php" method = "post"> <table border = 0> <tr> <td colspan = 2><select name = "type"><?php echo "$type_option"; ?></select></td> </tr> <tr> <td height = 30 colspan = 2 valign = "bottom"><select name = "state"><?php echo "$state_option"; ?></select></td> </tr> <tr> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "zip" size = 6 maxlength = 12 value = "<?=$_SESSION[form_zip];?>"></td> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "city" size = 10 maxlength = 30 value = "<?=$_SESSION[form_city];?>"></td> </tr> <tr> <td colspan = 2 valign = "bottom">Key Word(s):</td> </tr> <tr> <td><input class = "form1" type = "text" name = "key_word" size = 20 maxlength = 100 value = "<?=$_SESSION[key_word];?>"></td> <td><input type = "submit" name = "submit" value = "Search" width = 120></td> </tr> </table> </form> </td> </tr> </table> <p> </p> </div> </div> </div> </div> </body> </html> Thanks to anyone who reads and posts!
-
Do you think you could help me with that?...I would love it of you would...because I have no idea what I'm doing here.
-
I've tried this...this does do the search and now displays content, but when I click the next button the next page of results do not show. Does anybody else know how to do advanced searches with PHP? here is the code that I just recently updated: <?php //connect include('../../includes/PHP/globals_db.inc'); $dbconn = mysql_connect($ecl_database_server, $ecl_username, $ecl_password) or die(mysql_error()); $select = mysql_select_db($ecl_database, $dbconn) or die(mysql_error()); //------------ //first lets make an array of letters A-Z $alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z"); $links_top = ""; foreach ($alpha as $links) { $links_top .= "<a class = \"checklist\" href = 'facilities.php?fac=$links'>"; if ($links == "Z") { $links_top .= "$links</a>"; } else { $links_top .= "$links</a> | "; } //end if } //end if if (isset($_POST[submit])) { if (!isset($_GET )) { $page = 1; } else { $page = $_GET ; } //end if $max_results = 10; $from = (($page * $max_results) - $max_results); //start the query statement for the search fields-starting with key word for default $query = "SELECT * FROM pub_gardens WHERE facility LIKE '%$_POST[key_word]%'"; //if the user selects a type of facility from drop down menu, add on to the query string //also make sure the first value of the drop down for the facility selection isnt the first if ($_POST[type] != "Type of Facility") { $query .= " OR type = '$_POST[type]'"; } //end if //if the user selects a state from drop down menu, add on to the query string //also make sure the first value of the drop down for the state selection isnt the first if ($_POST[state] != "State") { $query .= " OR state = '$_POST[state]'"; } //end if //if the user types in a city in the city field from the form, add on to the query string if ($_POST[city] != "") { //make sure the default value isnt "City" before adding on to the string if ($_POST[city] != "City") { $query .= " OR city LIKE '%$_POST[city]'"; } //end if } //end if //if the user types in a zip code in the zip field from the form, add on to the query string if ($_POST[zip] != "") { //make sure the default value isnt "Zip" before adding on to the string if ($_POST[zip] != "Zip") { $query .= " OR zip LIKE '%$_POST[zip]'"; } //end if } //end if //add on last addition to the $query string variable $query .= " ORDER BY facility LIMIT $from, $max_results"; $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; // Figure out the total number of results in DB: $t_query = "SELECT COUNT(*) as Num FROM pub_gardens WHERE facility LIKE '%$_POST[key_word]%'"; //this section is the same type of code above if ($_POST[type] != "Type of Facility") { $t_query .= " OR type = '$_POST[type]'"; } //end if if ($_POST[state] != "State") { $t_query .= " OR state = '$_POST[state]'"; } //end if if ($_POST[city] != "") { if ($_POST[city] != "City") { $t_query .= " OR city LIKE '%$_POST[city]'"; } //end if } //end if if ($_POST[zip] != "") { if ($_POST[zip] != "Zip") { $t_query .= " OR zip LIKE '%$_POST[zip]'"; } //end if } //end if //result $t_result = mysql_query($t_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if //type array $fac_type = array("Type of Facility" => "None", "Arboretum" => "A", "Arboretum/Garden" => "A, G", "Garden" => "G", "Garden/Arboretum" => "G, A", "Park" => "P", "Park/Garden" => "P, G", "Garden/Park" => "G, P", "Conservatory" => "C"); //states $fac_state = array("State Select" => "State", "Alabama" => "AL", "Alaska" => "AL", "Arizona" => "AZ", "Arkansas" => "AK", "California" => "CA", "Colorado" => "CO", "Connecticut" => "CT", "Delaware" => "DE", "Dist of Columbia" => "DC", "Florida" => "FL", "Georgia" => "GA", "Hawaii" => "HI", "Idaho" => "ID", "Illinois" => "IL", "Indiana" => "IN", "Iowa" => "IA", "Kansas" => "KS", "Kentucky" => "KY", "Louisiana" => "LA", "Maine" => "ME", "Maryland" => "MD", "Massachusetts" => "MA", "Michigan" => "MI", "Minnesota" => "MN", "Mississippi" => "MS", "Missouri" => "MO", "Montana" => "MT", "Nebraska" => "NE", "Nevada" => "NV", "New Hampshire" => "NH", "New Jersey" => "NJ", "New Mexico" => "NM", "New York" => "NY", "North Carolina" => "NC", "North Dakota" => "ND", "Ohio" => "OH", "Oklahoma" => "OK", "Oregon" => "OR", "Pennsylvania" => "PA", "Rhode Island" => "RI", "South Carolina" => "SC", "South Dakota" => "SD", "Tennessee" => "TN", "Texas" => "TX", "Utah" => "UT", "Vermont" => "VT", "Virginia" => "VA", "Washington" => "WA", "West Virginia" => "WV", "Wisconsin" => "WI", "Wyoming" => "WY"); /* //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach */ foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($_POST[type] == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach /* //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach */ foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($_POST[state] == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if } //end if ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>eCountryLifestyle: Public Garden Directory</title> <link href="../../_css/style_popup.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="layoutContainer"> <div id="headerHome"><img src="../images/public_garden_directory_banner.jpg" alt="Public Garden Directory" width="784" height="182" /></div> <div id="contentLayout"> <div id="searchLayoutChecklist"> <div class="topLinkTextNormalHeading" >Browse by Facility Name: <span class="topLinkTextNormal"><?php print "$links_top"; ?></span></div> </div> <div id="content"> <div id="contents"> <div id="sidebarLayout"> <p align="center"><a href="http://www.cotton.org/index.cfm" target="_blank"><img src="../images/associations/national_cotton_counsel.jpg" alt="National Cotton Counsil" width="180" height="90" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.mulchandsoilcouncil.org/index.html" target="_blank"><img src="../images/associations/mulch_and_soil_counsl.jpg" alt="Mulch and Soil Council" width="180" height="157" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.bluediamond.com/" target="_blank"><img src="../images/associations/blue_diamond_almonds.jpg" alt="Blue Diamonds Almonds" width="180" height="127" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.naturalproductsassoc.org/site/PageServer" target="_blank"><img src="../images/associations/natural_pro_assocn.jpg" alt="National Products Association" width="180" height="82" border="0" /></a></p> </div> <h1 class="subtitle">Public Garden Directory<br /> <br /> </h1> <?php print "$display"; ?><br><br> <table width="525" border="0" cellpadding="2" cellspacing="0" class="table_box"> <tr> <td class="table_row_header1"><strong>Search</strong></td> </tr> <tr> <td class="table_main_content"> <form class = "form1" action = "advanced_search.php" method = "post"> <table border = 0> <tr> <td colspan = 2><select name = "type"><?php echo "$type_option"; ?></select></td> </tr> <tr> <td height = 30 colspan = 2 valign = "bottom"><select name = "state"><?php echo "$state_option"; ?></select></td> </tr> <tr> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "zip" size = 6 maxlength = 12 value = "<?=$_POST[zip];?>"></td> <td height = 30 valign = "bottom"><input class = "form1" type = "text" name = "city" size = 10 maxlength = 30 value = "<?=$_POST[city];?>"></td> </tr> <tr> <td colspan = 2 valign = "bottom">Key Word(s):</td> </tr> <tr> <td><input class = "form1" type = "text" name = "key_word" size = 20 maxlength = 100 value = "<?=$_POST[key_word];?>"></td> <td><input type = "submit" name = "submit" value = "Search" width = 120></td> </tr> </table> </form> </td> </tr> </table> <p> </p> </div> </div> </div> </div> </body> </html>
-
I'm trying to use multiple LIKE statments. Whats not working? When I test it to search, no results display. I know it has to be with the $query selection variables.
-
Has anyone worked with advanced searches?
-
I'm trying to do an advanced search with more than 2 fields to search from and I've never done this before. my code: <?php <?php //connect include('../../includes/PHP/globals_db.inc'); $dbconn = mysql_connect($ecl_database_server, $ecl_username, $ecl_password) or die(mysql_error()); $select = mysql_select_db($ecl_database, $dbconn) or die(mysql_error()); //------------ //first lets make an array of letters A-Z $alpha = array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "Y", "Z"); $links_top = ""; foreach ($alpha as $links) { $links_top .= "<a class = \"checklist\" href = 'facilities.php?fac=$links'>"; if ($links == "Z") { $links_top .= "$links</a>"; } else { $links_top .= "$links</a> | "; } //end if } //end if if (isset($_POST[submit])) { if (!isset($_GET )) { $page = 1; } else { $page = $_GET ; } //end if $max_results = 10; $from = (($page * $max_results) - $max_results); //start the query statement for the search fields-starting with key word for default $query = "SELECT * FROM pub_gardens WHERE facility LIKE '$_POST[key_word]%'"; //if the user selects a type of facility from drop down menu, add on to the query string //also make sure the first value of the drop down for the facility selection isnt the first if ($_POST[type] != "Type of Facility") { $query .= " AND type = '$_POST[type]'"; } //end if //if the user selects a state from drop down menu, add on to the query string //also make sure the first value of the drop down for the state selection isnt the first if ($_POST[state] != "State") { $query .= " AND state = '$_POST[state]'"; } //end if //if the user types in a city in the city field from the form, add on to the query string if ($_POST[city] != "") { //make sure the default value isnt "City" before adding on to the string if ($_POST[city] != "City") { $query .= " AND city LIKE '$_POST[city]%'"; } //end if } //end if //if the user types in a zip code in the zip field from the form, add on to the query string if ($_POST[zip] != "") { //make sure the default value isnt "Zip" before adding on to the string if ($_POST[zip] != "Zip") { $query .= " AND zip LIKE '$_POST[zip]%'"; } //end if } //end if //add on last addition to the $query string variable $query .= " ORDER BY facility LIMIT $from, $max_results"; $result = mysql_query($query) or die(mysql_error() . " : " .__LINE__); //start table $display = "<font color = \"#ff0000\">*Types (A = Arboretum, G = Garden, C = Conservatory, P = Park)</font>\n"; $display .= "<table border = 0 width = 500 cellspacing = 0>\n"; $display .= "<tr>\n"; $display .= "<th>Facility</th>\n"; $display .= "<th>State</th>\n"; $display .= "<th>Type</th>\n"; $display .= "</tr>\n\n"; //background color for <tr> $bgcolor = "#f5fffa"; while ($row = mysql_fetch_array($result)) { if ($bgcolor == "#f5fffa") { $bgcolor = "#ffffff"; } else { $bgcolor = "#f5fffa"; } //end if //display table row data $display .= "<tr bgcolor = \"".$bgcolor."\">\n"; $display .= "<td><a href = 'view_facility.php?f=$row[iD]'>$row[facility]</a></td>\n"; $display .= "<td>$row[state]</td>\n"; $display .= "<td>$row[type]</td>\n"; $display .= "</tr>\n"; } //end while $display .= "</table>\n"; // Figure out the total number of results in DB: $t_query = "SELECT COUNT(*) as Num FROM pub_gardens WHERE facility LIKE '$_POST[key_word]%'"; //this section is the same type of code above if ($_POST[type] != "Type of Facility") { $t_query .= " AND type = '$_POST[type]'"; } //end if if ($_POST[state] != "State") { $t_query .= " AND state = '$_POST[state]'"; } //end if if ($_POST[city] != "") { if ($_POST[city] != "City") { $t_query .= " AND city LIKE '$_POST[city]%'"; } //end if } //end if if ($_POST[zip] != "") { if ($_POST[zip] != "Zip") { $t_query .= " AND zip LIKE '$_POST[zip]%'"; } //end if } //end if //result $t_result = mysql_query($t_query) or die(mysql_error() . " : " .__LINE__); $total_results = mysql_result($t_result,0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks // Build Previous Link if ($page > 1) { $prev = ($page - 1); $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$prev\"><< PREVIOUS</a> "; } //end if for ($i = 1; $i <= $total_pages; $i++) { if (($page) == $i) { $display .= "<strong>$i</strong> "; } else { $display .= "<a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$i\">$i</a> "; } //end if } //end if // Build Next Link if ($page < $total_pages) { $next = ($page + 1); $display .= " <a class = \"checklist\" href=\"".$_SERVER[php_SELF]."?page=$next\">NEXT >></a>"; } //end if //type array $fac_type = array("Type of Facility" => "None", "Arboretum" => "A", "Arboretum/Garden" => "A, G", "Garden" => "G", "Garden/Arboretum" => "G, A", "Park" => "P", "Park/Garden" => "P, G", "Garden/Park" => "G, P", "Conservatory" => "C"); //states $fac_state = array("State Select" => "State", "Alabama" => "AL", "Alaska" => "AL", "Arizona" => "AZ", "Arkansas" => "AK", "California" => "CA", "Colorado" => "CO", "Connecticut" => "CT", "Delaware" => "DE", "Dist of Columbia" => "DC", "Florida" => "FL", "Georgia" => "GA", "Hawaii" => "HI", "Idaho" => "ID", "Illinois" => "IL", "Indiana" => "IN", "Iowa" => "IA", "Kansas" => "KS", "Kentucky" => "KY", "Louisiana" => "LA", "Maine" => "ME", "Maryland" => "MD", "Massachusetts" => "MA", "Michigan" => "MI", "Minnesota" => "MN", "Mississippi" => "MS", "Missouri" => "MO", "Montana" => "MT", "Nebraska" => "NE", "Nevada" => "NV", "New Hampshire" => "NH", "New Jersey" => "NJ", "New Mexico" => "NM", "New York" => "NY", "North Carolina" => "NC", "North Dakota" => "ND", "Ohio" => "OH", "Oklahoma" => "OK", "Oregon" => "OR", "Pennsylvania" => "PA", "Rhode Island" => "RI", "South Carolina" => "SC", "South Dakota" => "SD", "Tennessee" => "TN", "Texas" => "TX", "Utah" => "UT", "Vermont" => "VT", "Virginia" => "VA", "Washington" => "WA", "West Virginia" => "WV", "Wisconsin" => "WI", "Wyoming" => "WY"); /* //put "type" into options foreach ($fac_type as $type) { $type_option .= "<option value = \"$type\">$type</option>"; } //end foreach */ foreach ($fac_type as $type => $letters) { $type_option .= "<option value = $letters\n"; if ($_POST[type] == $letters) { $type_option .= " SELECTED\n"; } //end if $type_option .= ">$type</option>\n"; } //end foreach /* //put "state" into options foreach ($fac_state as $state => $ac) { $state_option .= "<option value = \"$ac\">$state</option>"; } //end foreach */ foreach ($fac_state as $state => $ac) { $state_option .= "<option value = $ac\n"; if ($_POST[state] == $ac) { $state_option .= " SELECTED\n"; } //end if $state_option .= ">$state</option>\n"; } //end if //search $search = "<form action = \"$_SERVER[php_SELF]\" method = \"post\">\n"; $search .= "<table border = 0>\n"; $search .= "<tr>\n"; $search .= "<td><select name = \"type\">$type_option</select></td>\n"; $search .= "<td></td>\n"; $search .= "<td></td>\n"; $search .= "</tr>\n\n"; $search .= "<tr>\n"; $search .= "<td><select name = \"state\">$state_option</select></td>\n"; $search .= "<td><input type = \"text\" name = \"city\" size = 10 maxlength = 30 value = \"$_POST[city]\"></td>\n"; $search .= "<td><input type = \"text\" name = \"zip\" size = 6 maxlength = 12 value = \"$_POST[zip]\"></td>\n"; $search .= "</tr>\n\n"; $search .= "<tr>\n"; $search .= "<td><strong>Key Word(s):</strong><input type = \"text\" name = \"key_word\" size = 20 maxlength = 100 value = \"$_POST[key_word]\"></td>\n"; $search .= "<td><input type = \"submit\" name = \"submit\" value = \"Search\"></td>\n"; $search .= "<td></td>\n"; $search .= "</tr>\n\n"; $search .= "</table>\n"; $search .= "</form>\n"; } //end if ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>eCountryLifestyle: Public Garden Directory</title> <link href="../../_css/style_popup.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="layoutContainer"> <div id="headerHome"><img src="../images/public_garden_directory_banner.jpg" alt="Public Garden Directory" width="784" height="182" /></div> <div id="contentLayout"> <div id="searchLayoutChecklist"> <div class="topLinkTextNormalHeading" >Browse by Facility Name: <span class="topLinkTextNormal"><?php print "$links_top"; ?></span></div> </div> <div id="content"> <div id="contents"> <div id="sidebarLayout"> <p align="center"><a href="http://www.cotton.org/index.cfm" target="_blank"><img src="../images/associations/national_cotton_counsel.jpg" alt="National Cotton Counsil" width="180" height="90" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.mulchandsoilcouncil.org/index.html" target="_blank"><img src="../images/associations/mulch_and_soil_counsl.jpg" alt="Mulch and Soil Council" width="180" height="157" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.bluediamond.com/" target="_blank"><img src="../images/associations/blue_diamond_almonds.jpg" alt="Blue Diamonds Almonds" width="180" height="127" border="0" /></a></p> <p> </p> <p align="center"><a href="http://www.naturalproductsassoc.org/site/PageServer" target="_blank"><img src="../images/associations/natural_pro_assocn.jpg" alt="National Products Association" width="180" height="82" border="0" /></a></p> </div> <h1 class="subtitle">Public Garden Directory<br /> <br /> </h1> <?php print "$display"; ?><br><br> <table width="525" border="0" cellpadding="2" cellspacing="0" class="table_box"> <tr> <td class="table_row_header1"><strong>Search</strong></td> </tr> <tr> <td class="table_main_content"><?php print "$search"; ?></td> </tr> </table> <p> </p> </div> </div> </div> </div> </body> </html> ?> The search isnt working... Here is the link to a page that submits to the code above: http://devel.ecountrylifestyle.com/green_thumb_gardener/resources/facilities.php?fac=A mind the bad table format with the search section.
-
And here is the .js file its including // Aurigma Image Uploader Embedding Script // Version 2.0.2.0 August 21, 2006 // Copyright(c) Aurigma Inc. 2002-2006 function __Browser(){ var a=navigator.userAgent.toLowerCase(); this.isOpera=(a.indexOf("opera")!=-1); this.isKonq=(a.indexOf('konqueror')!=-1); this.isSafari=(a.indexOf('safari')!=-1)&&(a.indexOf('mac')!=-1); this.isKhtml=this.isSafari||this.isKonq; this.isIE=(a.indexOf("msie")!=-1)&&!this.isOpera; this.isWinIE=this.isIE&&(a.indexOf("win")!=-1); this.isCSS1Compat=(!this.isIE)||(document.compatMode&&document.compatMode=="CSS1Compat"); } var __browser=new __Browser(); //Create set/get expando methods for ActiveX function _createExpandoMethods(id){ var o=document.getElementById(id); var props=new Array(); for (propName in o){ var c=propName.charAt(0); if (c==c.toUpperCase()){ props.push(propName); } } for (i=0;i<props.length;i++){ //Check whether property is indexed if (typeof(o[props[i]])=="unknown"){ eval("o.set"+props[i]+"=function(i,v){this."+props[i]+"(i)=v;};"); eval("o.get"+props[i]+"=function(i){return this."+props[i]+"(i);};"); } else{ eval("o.set"+props[i]+"=function(v){this."+props[i]+"=v};"); eval("o.get"+props[i]+"=function(){return this."+props[i]+"};"); } } // PaneItemDesign eval("o.setPaneItemDesign = function(Pane, Index, Value){this.PaneItemDesign(Pane, Index) = Value;};"); eval("o.getPaneItemDesign = function(Pane, Index){return this.PaneItemDesign(Pane, Index);};"); // PaneItemSelected eval("o.getPaneItemSelected = function(Pane, Index){return this.PaneItemSelected(Pane, Index);};"); // PaneItemEnabled eval("o.setPaneItemEnabled = function(Pane, Index, Value){this.PaneItemEnabled(Pane, Index) = Value;};"); eval("o.getPaneItemEnabled = function(Pane, Index){return this.PaneItemEnabled(Pane, Index);};"); } //Installation instructions function _addInstructions(obj){ obj.instructionsEnabled=true; if (obj.controlClass=="FileDownloader"){ obj.instructionsCommon="File Downloader ActiveX control is necessary to download "+ "files quickly and easily. You will be able to select required files "+ "in a user-friendly interface and simply click a 'Download' button. "+ "Installation will take up to few minutes, please be patient. To install File Downloader, "; obj.instructionsNotWinXPSP2="please reload the page and click the \"Yes\" button " + "when you see the control installation dialog." obj.instructionsWinXPSP2="please click the Information Bar. After page reloads click \"Yes\" when "+ "you see the control installation dialog."; } else { obj.instructionsCommon="Image Uploader ActiveX control is necessary to upload "+ "your files quickly and easily. You will be able to select multiple images "+ "in user-friendly interface instead of clumsy input fields with Browse button. "+ "Installation will take up to few minutes, please be patient. To install Image Uploader, "; obj.instructionsNotWinXPSP2="please reload page and select \"Yes\" button " + "when you will see control installation dialog." obj.instructionsWinXPSP2="please click on Information Bar. After page reloading select \"Yes\" when "+ "you will see control installation dialog."; } } function ControlWriter(id,width,height){ //Private this._params=new Array(); this._events=new Array(); this._getObjectParamHtml=function(name,value){ return "<param name=\""+name+"\" value=\""+value+"\" />"; } this._getObjectParamsHtml=function(){ var r=""; var p=this._params; var i; for (i=0;i<p.length;i++){ r+=this._getObjectParamHtml(p[i].name,p[i].value); } return r; } this._getObjectEventsHtml=function(){ var r=""; var e=this._events; for (i=0;i<e.length;i++){ r+=this._getObjectParamHtml(e[i].name+"Listener",e[i].listener); } return r; } this._getEmbedParamHtml=function(name,value){ return " "+name+"=\""+value+"\""; } this._getEmbedParamsHtml=function(){ var r=""; var p=this._params; var i; for (i=0;i<p.length;i++){ r+=this._getEmbedParamHtml(p[i].name,p[i].value); } return r; } this._getEmbedEventsHtml=function(){ var r=""; var e=this._events; for (i=0;i<e.length;i++){ r+=this._getEmbedParamHtml(e[i].name+"Listener",e[i].listener); } return r; } //Public //Properties this.id=id; this.width=width; this.height=height; this.activeXControlEnabled=true; this.activeXControlVersion=""; this.javaAppletEnabled=true; this.javaAppletCodeBase="./"; this.javaAppletCached=true; this.javaAppletVersion=""; this.fullPageLoadListenerName=null; //Methods this.addParam=function(paramName,paramValue){ var p=new Object(); p.name=paramName; p.value=paramValue; this._params.push(p); } this.addEventListener=function(eventName,eventListener){ var p=new Object(); p.name=eventName; p.listener=eventListener; this._events.push(p); } this.getActiveXInstalled=function(){ if (this.activeXProgId){ try{ var a=new ActiveXObject(this.activeXProgId); return true; } catch(e){ return false; } } return false; } this.getHtml=function(){ var r=""; if (this.fullPageLoadListenerName){ r+="<" + "script type=\"text/javascript\">"; r+="var __"+this.id+"_pageLoaded=false;"; r+="var __"+this.id+"_controlLoaded=false;"; r+="function __fire_"+this.id+"_fullPageLoad(){"; r+="if (__"+this.id+"_pageLoaded&&__"+this.id+"_controlLoaded){"; r+=this.fullPageLoadListenerName + "();"; r+="}"; r+="}"; var pageLoadCode="new Function(\"__"+this.id+"_pageLoaded=true;__fire_"+this.id+"_fullPageLoad();\")"; if (__browser.isWinIE){ r+="window.attachEvent(\"onload\","+pageLoadCode+");"; } else{ r+="var r=window.addEventListener?window:document.addEventListener?document:null;"; r+="if (r){r.addEventListener(\"load\","+pageLoadCode+",false);}"; } r+="<"+"/script>"; } _addInstructions(this); //ActiveX control if(__browser.isWinIE&&this.activeXControlEnabled){ var v=this.activeXControlVersion.replace(/\./g,",") var cb=this.activeXControlCodeBase+(v==""?"":"#version="+v); r+="<" + "script for=\""+this.id+"\" event=\"InitComplete()\">"; r+="_createExpandoMethods(\""+this.id+"\");"; if (this.fullPageLoadListenerName){ r+="__"+this.id+"_controlLoaded=true;"; r+="__fire_"+this.id+"_fullPageLoad();"; } r+="<"+"/script>"; r+="<object id=\""+this.id+"\" name=\""+this.id+"\" classid=\"clsid:"+this.activeXClassId+"\" codebase=\""+cb+"\" width=\""+this.width+"\" height=\""+this.height+"\">"; if (this.instructionsEnabled){ r+=this.instructionsCommon; var isXPSP2=(window.navigator.userAgent.indexOf("SV1") != -1); if (isXPSP2){ r+=this.instructionsWinXPSP2; } else{ r+=this.instructionsNotWinXPSP2; } } r+=this._getObjectParamsHtml(); r+="</object>"; //Event handlers var e=this._events; var eventParams; for (i=0;i<e.length;i++){ if (this.controlClass=="FileDownloader"){ switch (e[i].name){ case "DownloadComplete": eventParams="Value"; break; case "DownloadItemComplete": eventParams="Result, ErrorPage, Url, FileName, ContentType, FileSize"; break; case "DownloadStep": eventParams="Step"; break; case "Progress": eventParams="PercentTotal, PercentCurrent, Index"; break; case "Error": eventParams="ErrorCode, HttpErrorCode, ErrorPage, Url, Index"; break; default: eventParams=""; } r+="<script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">"; r+=e[i].listener+"("+eventParams+");"; r+="<"+"/script>"; } else { switch (e[i].name){ case "Progress": eventParams="Status, Progress, ValueMax, Value, StatusText"; break; case "InnerComplete": eventParams="Status, StatusText"; break; case "ViewChange": case "SortModeChange": eventParams="Pane"; break; default: eventParams=""; } } r+="<" + "script for=\""+this.id+"\" event=\""+e[i].name+"("+eventParams+")\">"; if (e[i].name=="BeforeUpload"){ r+="return "; } r+=e[i].listener+"("+eventParams+");"; r+="<"+"/script>"; } } else //Java appplet if(this.javaAppletEnabled){ if (this.fullPageLoadListenerName){ r+="<" + "script type=\"text/javascript\">"; r+="function __"+this.id+"_InitComplete(){"; r+="__"+this.id+"_controlLoaded=true;"; r+="__fire_"+this.id+"_fullPageLoad();"; r+="}"; r+="<"+"/script>"; } //<object> for IE and <applet> for Safari if (__browser.isWinIE||__browser.isKhtml){ if (__browser.isWinIE){ r+="<object id=\""+this.id+"\" classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\" codebase=\""+window.location.protocol+"//java.sun.com/update/1.4.2/jinstall-1_4-windows-i586.cab#Version=1,4,0,0\" width=\""+this.width+"\" height=\""+this.height+"\">"; } else{ r+="<applet id=\""+this.id+"\" code=\""+this.javaAppletClassName+"\" java_codebase=\"../\" align=\"baseline\" archive=\""+this.javaAppletJarFileName+"\" mayscript=\"true\" scriptable=\"true\" width=\""+this.width+"\" height=\""+this.height+"\">"; } if (this.javaAppletCached&&this.javaAppletVersion!=""){ r+=this._getObjectParamHtml("cache_archive",this.javaAppletJarFileName); var v=this.javaAppletVersion.replace(/\,/g,"."); r+=this._getObjectParamHtml("cache_version",v+","+v); } r+=this._getObjectParamHtml("type","application/x-java-applet;version=1.4"); r+=this._getObjectParamHtml("codebase",this.javaAppletCodeBase); r+=this._getObjectParamHtml("archive",this.javaAppletJarFileName); r+=this._getObjectParamHtml("code",this.javaAppletClassName); r+=this._getObjectParamHtml("scriptable","true"); r+=this._getObjectParamHtml("mayscript","true"); r+=this._getObjectParamsHtml(); r+=this._getObjectEventsHtml(); if (this.fullPageLoadListenerName){ r+=this._getObjectParamHtml("InitCompleteListener","__"+this.id+"_InitComplete"); } if (__browser.isWinIE){ r+="</object>"; } else{ r+="</applet>"; } } //<embed> for all other browsers else{ r+="<embed id=\""+this.id+"\" type=\"application/x-java-applet;version=1.4\" codebase=\""+this.javaAppletCodeBase+"\" code=\""+this.javaAppletClassName+"\" archive=\""+this.javaAppletJarFileName+"\" width=\""+this.width+"\" height=\""+this.height+"\" scriptable=\"true\" mayscript=\"true\" pluginspage=\""+window.location.protocol+"//java.sun.com/products/plugin/index.html#download\""; if (this.javaAppletCached&&this.javaAppletVersion!=""){ r+=this._getEmbedParamHtml("cache_archive",this.javaAppletJarFileName); var v=this.javaAppletVersion.replace(/\,/g,"."); r+=this._getEmbedParamHtml("cache_version",v+","+v); } r+=this._getEmbedParamsHtml(); r+=this._getEmbedEventsHtml(); if (this.fullPageLoadListenerName){ r+=this._getEmbedParamHtml("InitCompleteListener","__"+this.id+"_InitComplete"); } r+=">"; r+="</embed>"; } } else { r+="Your browser is not supported."; } //For backward compatibility this.controlType=this.getControlType(); return r; } this.getControlType=function(){ return (__browser.isWinIE&&this.activeXControlEnabled)?"ActiveX":(this.javaAppletEnabled?"Java":"None"); } this.writeHtml=function(){ document.write(this.getHtml()); } } function ImageUploaderWriter(id,width,height){ this._base=ControlWriter; this._base(id,width,height); //These properties should be modified for private label versions only this.activeXControlCodeBase="ImageUploader4.cab"; this.activeXClassId="6E5E167B-1566-4316-B27F-0DDAB3484CF7"; this.activeXProgId="Aurigma.ImageUploader.4"; this.javaAppletJarFileName="ImageUploader2.jar"; this.javaAppletClassName="com.aurigma.imageuploader.ImageUploader.class"; //Extend this.showNonemptyResponse="off"; this._getHtml=this.getHtml; this.getHtml=function(){ var r=""; if (this.showNonemptyResponse!="off"){ r+="<" + "script type=\"text/javascript\">"; r+="function __"+this.id+"_InnerComplete(Status,StatusText){"; r+="if (new String(Status)==\"COMPLETE\" && new String(StatusText).replace(/\\s*/g,\"\")!=\"\"){"; if (this.showNonemptyResponse=="dump"){ r+="var f=document.createElement(\"fieldset\");"; r+="var l=f.appendChild(document.createElement(\"legend\"));"; r+="l.appendChild(document.createTextNode(\"Server Response\"));"; r+="var d=f.appendChild(document.createElement(\"div\"));"; r+="d.innerHTML=StatusText;"; r+="var b=f.appendChild(document.createElement(\"button\"));"; r+="b.appendChild(document.createTextNode(\"Clear Server Response\"));"; r+="b.onclick=function(){var f=this.parentNode;f.parentNode.removeChild(f)};"; r+="document.body.appendChild(f);"; } else{ var s=""; for (var i=0;i<80;i++){s+="-";} r+="alert(\""+s+"\\r\\nServer Response\\r\\n"+s+"\\r\\n\"+StatusText);"; } r+="}"; r+="}"; r+="<"+"/script>"; this.addEventListener("InnerComplete","__"+this.id+"_InnerComplete"); } return r+this._getHtml(); } } function ThumbnailWriter(id,width,height){ this._base=ControlWriter; this._base(id,width,height); //These properties should be modified for private label versions only this.activeXControlCodeBase="ImageUploader4.cab"; this.activeXClassId="C619C11D-333B-4379-9062-E52FC1332CA2"; this.activeXProgId="Aurigma.ImageUploader.4"; this.javaAppletJarFileName="ImageUploader2.jar"; this.javaAppletClassName="com.aurigma.imageuploader.Thumbnail.class"; } function ShellComboBoxWriter(id,width,height){ this._base=ControlWriter; this._base(id,width,height); //These properties should be modified for private label versions only this.activeXControlCodeBase="ImageUploader4.cab"; this.activeXClassId="BBF89515-EDB6-4236-8FBB-B6045290076D"; this.activeXProgId="Aurigma.ImageUploader.4"; this.javaAppletJarFileName="ImageUploader2.jar"; this.javaAppletClassName="com.aurigma.imageuploader.ShellComboBox.class"; } function UploadPaneWriter(id,width,height){ this._base=ControlWriter; this._base(id,width,height); //These properties should be modified for private label versions only this.activeXControlCodeBase="ImageUploader4.cab"; this.activeXClassId="72D36C78-CC12-445C-8169-CCC942B61100"; this.activeXProgId="Aurigma.UploadPane.4"; this.javaAppletJarFileName="ImageUploader2.jar"; this.javaAppletClassName="com.aurigma.imageuploader.UploadPane.class"; } function FileDownloaderWriter(id,width,height){ this._base=ControlWriter; this._base(id,width,height); //These properties should be modified for private label versions only this.activeXControlCodeBase="FileDownloader.cab"; this.activeXClassId="E1A26BBF-26C0-401D-B82B-5C4CC67457E0"; this.activeXProgId="Aurigma.FileDownloader.1"; this.javaAppletEnabled=false; this.controlClass="FileDownloader"; } function getControlObject(id){ if (__browser.isSafari){ return document[id]; } else{ return document.getElementById(id); } } function getImageUploader(id){ return getControlObject(id); } function getFileDownloader(id){ return getControlObject(id); }
-
This Javascript code isnt displaying content. <!-- Module : Photo Album upload time display page using the imageuploade folder and javascript Date : 2007/04/28 Developed By: Jigar Shah,Saurabh Ornawala(softweb Solutions) DB Ref.: whole database --> <script type="text/javascript" src="imageuploader/iuembed.js"></script> <table width="100%" cellpadding="0" cellspacing="0"> <form id="add_album_form" name="add_album_form" method="post" action="" enctype="multipart/form-data"> <tr> <td colspan="2" align="left"><h1>Create a Photo Album </h1></td> </tr> <tr><td colspan="2"><hr size="1" color= "#DFDFDF" width="100%" ></td></tr> <tr> <td align="center" colspan="2"> <table width="94%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DFDFDF"> <tr> <td align="left" bgcolor="#FFFFFF"> <span style="font-size:12px;font-weight:bold; color:#B5A359;"><span class="style1">Step 2 :</span> Upload <? albumtype($_SESSION['user_type']);?> Album Photos </span></td> <td align="right" bgcolor="#FFFFFF" class="smallfontsize">Click <input type="checkbox" name="checkbox" value="checkbox" disabled="disabled" /> for each picture you want to upload for this album </td> </tr> <tr> <td colspan="2" style="border:1px solid #DFDFDF;"><table width="100%" cellpadding="0" cellspacing="0" bgcolor="#f9f9f9"> <tr> <td colspan="2" class="smallfontsize" style="padding-left:25px;"> </td> </tr> <tr> <td colspan="2" class="smallfontsize" style="padding-left:25px;"><b>Please Note: File names cannot have special characters within them.</b></td> </tr> <tr> <td colspan="2" class="smallfontsize" style="padding-left:25px;"> </td> </tr> <tr> <td colspan="2" align="center"><script type="text/javascript"> //<![CDATA[ //Create JavaScript object that will embed Image Uploader to the page. var iu = new ImageUploaderWriter("ImageUploader1", 650, 500); //For ActiveX control full path to CAB file (including file name) should be specified. iu.activeXControlEnabled = true; iu.activeXControlCodeBase = "imageuploader/ImageUploader4.cab"; iu.activeXControlVersion = "4,1,1,0"; iu.javaAppletEnabled = true; //For Java applet only path to directory with JAR files should be specified (without file name). iu.javaAppletCodeBase = "imageuploader/"; iu.javaAppletCached = true; iu.javaAppletVersion = "2.1.1.0"; iu.showNonemptyResponse = "off"; //Configure appearance. iu.addParam("PaneLayout", "TwoPanes"); iu.addParam("ShowDebugWindow", "true"); iu.addParam("AllowRotate", "true"); iu.addParam("BackgroundColor", "#f9f9f9"); iu.addParam("ButtonSendText", "Upload"); iu.addParam("ShowDescriptions", "false"); //Configure thumbnail settings. iu.addParam("UploadThumbnail1FitMode", "Fit"); iu.addParam("UploadThumbnail1Width", "640"); iu.addParam("UploadThumbnail1Height", "480"); iu.addParam("UploadThumbnail1JpegQuality", "60"); iu.addParam("CheckFilesBySelectAllButton", "true"); //Configure URL files are uploaded to. iu.addParam("Action", "upload.php?albumid=<? echo $albumid;?>"); //Configure URL where to redirect after upload. iu.addParam("RedirectUrl", "main.php?mode=addcaption&albumid=<? echo $albumid;?>"); //Tell Image Uploader writer object to generate all necessary HTML code to embed //Image Uploader to the page. iu.addParam("FileMask","*.jpg;*.jpeg;*.jpe;*.bmp;*.gif;*.giff") iu.addParam("LicenseKey", $_SERVER['ImageKeys']); iu.writeHtml(); //]]> </script></td> </tr> <tr> <td colspan="2" align="right"> </td> </tr> <tr> <td colspan="2" align="right"><input name="album_title" type="hidden" value="<? echo $_POST['album_title'];?>" /><input name="albumdescription" type="hidden" value="<? echo $_POST['albumdescription'];?>" /></td> </tr> <tr><td width="87%" align="right"><input type="submit" name="back" value="Back" class="tradeassoc_btn" onclick="this.form.action='main.php?mode=addalbum&albumid=<? echo $albumid;?>&act=back'" /> </td> <td width="13%" align="left"><input type="button" name="cancel" value="Cancel" class="tradeassoc_btn" onclick="javascript:window.location='main.php?act=cancel&albumid=<?=$albumid;?>'" /></td> </tr> <tr> <td colspan="2" align="right"> </td> </tr> </table></td> </tr> </table></td> </tr> <tr><td height="20"></td></tr> <tr><td><hr size="1" color= "#DFDFDF" width="100%" ></td></tr> <tr><td height="40"></td></tr> </form> </table>
-
substr() function may help
-
if (!isset($_POST[submit])) { $show_form = "yes"; } elseif (isset($_POST[submit])) { //do process } //end if if ($show_form == "yes") { $display = "<form ... } //end if Use $_SERVER[php_SELF] for the form action then print the display code later in html <html> <head> ... </head> <body> <?php print "$display"; ?> </body> </html>
-
True I wasnt thinking about that part...
-
echo "<table class=\"events\" width=\"90%\">\n"; echo "<tr>\n"; echo "<th>Event</th>\n"; echo "<th>Year</th>\n"; echo "<th>Team</th>\n"; echo "</tr>\n\n"; echo "<tr>\n"; echo "<td>$row[EventName]</td>\n"; echo "<td>$row[Year]</td>\n"; echo "<td>" . printf($link2, $row['EventName'], $row['Year']) . "</td>\n"; echo "</tr>\n"; echo "</table>\n";
-
What the heck
-
[SOLVED] Feeding data from php form to Web link
Neptunus Maris replied to martyoo's topic in PHP Coding Help
<?php if (!isset($_POST[submit])) { $form = "yes"; } elseif (isset($_POST[submit])) { header("Location: http://website.net/sendsms.aspx?s=m&d=$_POST[d]&m=$_POST[m]"); exit; } //end if if ($form == "yes") { $display = "<form action = \"$_SERVER[php_SELF]\" method = \"post\">\n"; $display .= "<table border = 0>\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">D:</td>\n"; $display .= "<td><input type = \"text\" name = \"d\"></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td align = \"right\">M:</td>\n"; $display .= "<td><input type = \"text\" name = \"m\"></td>\n"; $display .= "</tr>\n\n"; $display .= "<tr>\n"; $display .= "<td></td>\n"; $display .= "<td><input type = \"submit\" name = \"submit\" value = \"Go\"></td>\n"; $display .= "</tr>\n"; $display .= "</table>\n"; $display .= "</form>\n"; } //end if ?> <html> <head> <title>Test Page</title> </head> <body> <p><?php print "$display"; ?></p> </body> </html> That should do it!