pixeltrace Posted February 28, 2007 Share Posted February 28, 2007 guys, i need help on my drop down i have two drop down wherein i want its value to change the variable in my query but i dont know how to do it. so here i have 1. drop down menu for (name, id, date) 2. drop down menu for (ASC, DESC) 3. a go or submit button my query is something like this $test->sql = "SELECT * FROM job_ads WHERE ".$sort1." '.$sort2'"; and below is my codes for the drop down <form> sort by: <select name="firstoption"> <option value="1">name</option> <option value="2">ID</option> <option value="3">date</option> </select> <select name="secondoption"> <option value="1">ASC</option> <option value="2">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </form> what i wanted to happen is on the first drop down, its will change the value of sort1 on the second drop down it will change the value of sort2 then when the go or submit button is selected changes will be down. how to this is i dont have any ideas yet. hope you guys could help me with this. thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/ Share on other sites More sharing options...
nloding Posted February 28, 2007 Share Posted February 28, 2007 <form method="get" action="sort.php"> sort by: <select name="sort1"> <option value="name">name</option> <option value="id">ID</option> <option value="date">date</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </form> <?php $query = "SELECT * FROM job_ads ORDER BY" . $_GET['sort1'] . $_GET['sort2']; ?> If you want to keep the numeric values of the options, you can run a switch statement to make it either ASC or DESC or name. And make sure "name", "id", etc. are columns in your table. I'm assuming the sort options are on the same page as the results display ... in which case, I'd recommend using GET, and make the form action itself. Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-195997 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 yes, the result will also fall on the same page. i'll try this one. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196003 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 hi, i am getting an error. may i ask,, how do i add a default value since my query is on top of the form so when the page first loads, it will read the query first before the form. how do i add a default value on sort1 and sort2 so when the page loads this will be the value that the program will execute. i know that code line should be placed on top of the query but i dont have any idea what the code is and how. hope you could help me with this. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196047 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 need help on this please. this is the error message that i am getting now. Parse error: parse error, unexpected T_VARIABLE in c:\hosting\webhost4life\member\diorgrace\admean\job\view1.php on line 12 and this is the entire code of my page <?php session_start(); if (session_is_registered("username")){ include($_SERVER['DOCUMENT_ROOT']."/admean/pagina/my_pagina_class.php"); $test = new JHpage; $sort1 = "name"; $sort2 = "ASC"; $test->sql = "SELECT * FROM job_ads ORDER BY ".$_GET['sort1']." "$_GET['sort2']""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/spacer.gif" width="6" height="10"></td> <td><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"> <table width="1049" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="13"><table width="616" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="329" class="text6"> <?php echo " total record found: " .$total_recs; ?></td> <td width="287"> </td> </tr> </table></td> </tr> <tr> <td colspan="13"><form method="get" action="jobmngr.php?id=2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="783"> </td> <td width="262" class="text6">sort by : <select name="sort1"> <option value="name">name</option> <option value="id">ID</option> <option value="date">date</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table></form></td> </tr> <form action="jobrepost.php" method="post"> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8">| <a href="repost" class="link2">repost</a> | <a href="open" class="link2">open</a> | <a href="close" class="link2">close</a> | </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> <tr> <td width="29" align="center" bgcolor="#83C2ED" class="text5"> </td> <td width="51" align="center" bgcolor="#83C2ED" class="text5">ID</td> <td width="230" align="center" valign="top" bgcolor="#83C2ED" class="text5">title</td> <td width="140" align="center" bgcolor="#83C2ED" class="text5">level </td> <td width="254" align="center" bgcolor="#83C2ED" class="text5">client</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">N</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">C</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">S</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">I</td> <td width="24" align="center" bgcolor="#83C2ED" class="text5">B</td> <td width="28" align="center" bgcolor="#83C2ED" class="text5">CV</td> <td width="60" align="center" bgcolor="#83C2ED" class="text5">status</td> <td width="105" bgcolor="#83C2ED"> </td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $level = mysql_result($result, $i, "level"); $c_name = mysql_result($result, $i, "c_name"); $cperson = mysql_result($result, $i, "cperson"); $nconsidered = mysql_result($result, $i, "nconsidered"); $considered = mysql_result($result, $i, "considered"); $scheduled = mysql_result($result, $i, "scheduled"); $interviewed = mysql_result($result, $i, "interviewed"); $blocked = mysql_result($result, $i, "blocked"); $cv = mysql_result($result, $i, "cv"); $j_status = mysql_result($result, $i, "j_status"); ?> <tr> <td bgcolor="#FFFFCC" class="text8"><span class="text5"> <input type="checkbox" name="checkbox[]" value="<? echo"jobid"; ?>" /> </span></td> <td bgcolor="#FFFFCC" class="text8">J<? echo ($jobid <= 9) ? $jobid : $jobid;?> </td> <td bgcolor="#FFFFCC"> <a href="javascript:;" target="_blank" class="link1" onclick="MM_openBrWindow('job/jobpost.php?jobid=<? echo "$jobid"; ?>','','width=720')"> <? echo "$j_position";?></a></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$level";?> </td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$c_name";?><br> <i><? echo "$cperson";?></i></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$nconsidered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$considered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$scheduled";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$interviewed";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$blocked";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$cv";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$j_status";?></td> <? echo "<td align='center' bgcolor='#FFFFCC'><a href='jobmngr.php?id=3&jobid=$jobid' class='link1'>edit</a> | <a href='jobmngr.php?id=4&jobid=$jobid' class='link1'>applications</a> </td></tr>"; ?> <? } ?> <tr> <td colspan="13" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> </form> <tr> <td colspan="13"> </td> </tr> </table> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td><img src="../images/spacer.gif" width="6" height="10"></td> </tr> </table> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> hope you could help me with this. i am not sure if the assigning of my sort1 and sort2 variable is correct and my query too. need help thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196065 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 instead of using this $sort1 = "name"; $sort2 = "ASC"; $test->sql = "SELECT * FROM job_ads ORDER BY ".$_GET['sort1']." "$_GET['sort2']""; use it like this if(isset($_GET['sort1']) && $_GET['sort1']!='') $sort1 = $_GET['sort1']; else $sort1 = "name"; if(isset($_GET['sort2']) && $_GET['sort2']!='') $sort2 = $_GET['sort2']; else $sort2 = "ASC"; $test->sql = "SELECT * FROM job_ads ORDER BY ".$sort1." ".$sort2; Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196071 Share on other sites More sharing options...
nloding Posted February 28, 2007 Share Posted February 28, 2007 You're getting the T_VARIABLE error when you run the script the first time through, because the $_GET variables don't exist. If you didn't know, GET puts the variables in the URL ... so your URL already contains "?id=2" ... $_GET['id'] would equal 2 ... Since sort1 and sort2 aren't in the URL, the $_GET variables fail the first time through. You need to run the IF statements posted above. If the $_GET variables exist, then the sort variables are set to their values. If not, they are set to a default value. Then use $sort1 and $sort2 instead of $_GET in your query. I should have said that the first time, sorry. Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196075 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 hi, is the query correct? $test->sql = "SELECT * FROM job_ads ORDER BY ".$sort1." ".$sort2; or is it missing some "" or ' ? need help because i am getting errors from this line thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196086 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 $test->sql = "SELECT * FROM job_ads ORDER BY " . $sort1 . " ". $sort2 . ""; Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196087 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 if you still get the error then do this $test->sql = "SELECT * FROM job_ads ORDER BY $sort1 $sort2"; it will work.... Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196092 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 i used this and this is the error message that i am getting Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 90 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 63 Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in c:\hosting\webhost4life\member\diorgrace\admean\pagina\my_pagina_class.php on line 68 the codes of the page that this one is pertaining is my pagina source codes below is the code <?php /************************************************************************ JHpage ver. 1.03 Use this class to handle MySQL record sets and get page navigation links Copyright (c) 2005 -2006, Olaf Lederer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the finalwebsites.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. _________________________________________________________________________ available at http://www.finalwebsites.com/ Comments & suggestions: http://www.webdigity.com/index.php/board,77.0.html,ref.olaf Updates & bugfixes ver. 1.01 - There was a small bug inside the page_info() method while showing the last page (set). The error (last record) is fixed. There is also a small update in the method set_page(), the check is now with $_REQUEST values in place of $_GET values. ver. 1.02 - The link text (and the new image function) for the forward and backward links will be created with the new method build_back_or_forward(). Because there is no need anymore the variables str_forward and str_backward are removed. Check the example file for the possibility to use images in place of strings for the back- and forward navigation and the modified navigation() method. ver 1.03 - there is a new variable $max_rows, this variable is used to limit the maximum of results during a query. That will say if there are more rows then the number of $max_rows only the last one will show up. Use the new variable $outstanding_rows if you need to inform the user about that. Leave the value inside the constructor empty to disaple the function. Several variables are removed to give this class a safer and better structure. The method page_info() that builds the string with page number information is changed, only one (input) string (formatted with sprintf) is needed now. *************************************************************************/ require($_SERVER['DOCUMENT_ROOT']."/admean/pagina/db_config.php"); error_reporting(E_ALL); // only for testing class JHpage { var $sql; var $result; var $outstanding_rows = false; var $get_var; var $rows_on_page; var $max_rows; // constructor function JHpage($rows = 0) { $this->connect_db(); $this->max_rows = $rows; $this->get_var = QS_VAR; $this->rows_on_page = NUM_ROWS; } // sets the current page number function set_page() { $page = (isset($_REQUEST[$this->get_var]) && $_REQUEST[$this->get_var] != "") ? $_REQUEST[$this->get_var] : 0; return $page; } // gets the total number of records function get_total_rows() { $tmp_result = mysql_query($this->sql); $all_rows = mysql_num_rows($tmp_result); if (!empty($this->max_rows) && $all_rows > $this->max_rows) { $all_rows = $this->max_rows; $this->outstanding_rows = true; } mysql_free_result($tmp_result); return $all_rows; } // database connection function connect_db() { $conn_str = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $conn_str); } // get the totale number of result pages function get_num_pages() { $number_pages = ceil($this->get_total_rows() / $this->rows_on_page); return $number_pages; } // returns the records for the current page function get_page_result() { $start = $this->set_page() * $this->rows_on_page; $page_sql = sprintf("%s LIMIT %s, %s", $this->sql, $start, $this->rows_on_page); $this->result = mysql_query($page_sql); return $this->result; } // get the number of rows on the current page function get_page_num_rows() { $num_rows = mysql_num_rows($this->result); return $num_rows; } // free the database result function free_page_result() { mysql_free_result($this->result); } // function to handle other querystring than the page variable function rebuild_qs($curr_var) { if (!empty($_SERVER['QUERY_STRING'])) { $parts = explode("&", $_SERVER['QUERY_STRING']); $newParts = array(); foreach ($parts as $val) { if (stristr($val, $curr_var) == false) { array_push($newParts, $val); } } if (count($newParts) != 0) { $qs = "&".implode("&", $newParts); } else { return false; } return $qs; // this is your new created query string } else { return false; } } // this method will return the navigation links for the conplete recordset function navigation($separator = " | ", $css_current = "", $back_forward = false, $use_images = false) { $max_links = NUM_LINKS; $curr_pages = $this->set_page(); $all_pages = $this->get_num_pages() - 1; $var = $this->get_var; $navi_string = ""; if (!$back_forward) { $max_links = ($max_links < 2) ? 2 : $max_links; } if ($curr_pages <= $all_pages && $curr_pages >= 0) { if ($curr_pages > ceil($max_links/2)) { $start = ($curr_pages - ceil($max_links/2) > 0) ? $curr_pages - ceil($max_links/2) : 1; $end = $curr_pages + ceil($max_links/2); if ($end >= $all_pages) { $end = $all_pages + 1; $start = ($all_pages - ($max_links - 1) > 0) ? $all_pages - ($max_links - 1) : 1; } } else { $start = 0; $end = ($all_pages >= $max_links) ? $max_links : $all_pages + 1; } if($all_pages >= 1) { $forward = $curr_pages + 1; $backward = $curr_pages - 1; // the text two labels are new sinds ver 1.02 $lbl_forward = $this->build_back_or_forward("forward", $use_images); $lbl_backward = $this->build_back_or_forward("backward", $use_images); $navi_string = ($curr_pages > 0) ? "<a class='link1' href=\"".$_SERVER['PHP_SELF']."?".$var."=".$backward.$this->rebuild_qs($var)."\">".$lbl_backward."</a> " : $lbl_backward." "; if (!$back_forward) { for($a = $start + 1; $a <= $end; $a++){ $theNext = $a - 1; // because a array start with 0 if ($theNext != $curr_pages) { $navi_string .= "<a class='link1' href=\"".$_SERVER['PHP_SELF']."?".$var."=".$theNext.$this->rebuild_qs($var)."\">"; $navi_string .= $a."</a>"; $navi_string .= ($theNext < ($end - 1)) ? $separator : ""; } else { $navi_string .= ($css_current != "") ? "<span class='text6'\"".$css_current."\">".$a."</span>" : $a; $navi_string .= ($theNext < ($end - 1)) ? $separator : ""; } } } $navi_string .= ($curr_pages < $all_pages) ? " <a class='link1' href=\"".$_SERVER['PHP_SELF']."?".$var."=".$forward.$this->rebuild_qs($var)."\">".$lbl_forward."</a>" : " ".$lbl_forward; } } return $navi_string; } // function to create the back/forward elements; $what = forward or backward // type = text or img function build_back_or_forward($what, $img = false) { $label['text']['forward'] = STR_FWD; $label['text']['backward'] = STR_BWD; $label['img']['forward'] = IMG_FWD; $label['img']['backward'] = IMG_BWD; if ($img) { $img_info = getimagesize($label['img'][$what]); $label = "<img src=\"".$label['img'][$what]."\" ".$img_info[3]." border=\"0\">"; } else { $label = $label['text'][$what]; } return $label; } // this info will tell the visitor which number of records are shown on the current page function page_info($str = "Result: %d - %d of %d") { $first_rec_no = ($this->set_page() * $this->rows_on_page) + 1; $last_rec_no = $first_rec_no + $this->rows_on_page - 1; $last_rec_no = ($last_rec_no > $this->get_total_rows()) ? $this->get_total_rows() : $last_rec_no; $info = sprintf($str, $first_rec_no, $last_rec_no, $this->get_total_rows()); return $info; } // simple method to show only the page back and forward link. function back_forward_link($images = true) { $simple_links = $this->navigation(" ", "", false, $images); return $simple_links; } } ?> need help please thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196100 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 where "$this->sql" is defined I didn't find it anywhere... I can just c that you are just using it..... may be thats the problem... Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196104 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 its on the same page with the drop down <?php session_start(); if (session_is_registered("username")){ include($_SERVER['DOCUMENT_ROOT']."/admean/pagina/my_pagina_class.php"); $test = new JHpage; if(isset($_GET['sort1']) && $_GET['sort1']!='') $sort1 = $_GET['sort1']; else $sort1 = "name"; if(isset($_GET['sort2']) && $_GET['sort2']!='') $sort2 = $_GET['sort2']; else $sort2 = "ASC"; $test->sql = "SELECT * FROM job_ads ORDER BY ".$sort1 ." ".$sort2.""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/spacer.gif" width="6" height="10"></td> <td><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"> <table width="1049" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="13"><table width="616" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="329" class="text6"> <?php echo " total record found: " .$total_recs; ?></td> <td width="287"> </td> </tr> </table></td> </tr> <tr> <td colspan="13"><form method="get" action="jobmngr.php?id=2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="783"> </td> <td width="262" class="text6">sort by : <select name="sort1"> <option value="name">name</option> <option value="id">ID</option> <option value="date">date</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table></form></td> </tr> <form action="jobrepost.php" method="post"> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8">| <a href="repost" class="link2">repost</a> | <a href="open" class="link2">open</a> | <a href="close" class="link2">close</a> | </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> <tr> <td width="29" align="center" bgcolor="#83C2ED" class="text5"> </td> <td width="51" align="center" bgcolor="#83C2ED" class="text5">ID</td> <td width="230" align="center" valign="top" bgcolor="#83C2ED" class="text5">title</td> <td width="140" align="center" bgcolor="#83C2ED" class="text5">level </td> <td width="254" align="center" bgcolor="#83C2ED" class="text5">client</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">N</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">C</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">S</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">I</td> <td width="24" align="center" bgcolor="#83C2ED" class="text5">B</td> <td width="28" align="center" bgcolor="#83C2ED" class="text5">CV</td> <td width="60" align="center" bgcolor="#83C2ED" class="text5">status</td> <td width="105" bgcolor="#83C2ED"> </td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $level = mysql_result($result, $i, "level"); $c_name = mysql_result($result, $i, "c_name"); $cperson = mysql_result($result, $i, "cperson"); $nconsidered = mysql_result($result, $i, "nconsidered"); $considered = mysql_result($result, $i, "considered"); $scheduled = mysql_result($result, $i, "scheduled"); $interviewed = mysql_result($result, $i, "interviewed"); $blocked = mysql_result($result, $i, "blocked"); $cv = mysql_result($result, $i, "cv"); $j_status = mysql_result($result, $i, "j_status"); ?> <tr> <td bgcolor="#FFFFCC" class="text8"><span class="text5"> <input type="checkbox" name="checkbox[]" value="<? echo"jobid"; ?>" /> </span></td> <td bgcolor="#FFFFCC" class="text8">J<? echo ($jobid <= 9) ? $jobid : $jobid;?> </td> <td bgcolor="#FFFFCC"> <a href="javascript:;" target="_blank" class="link1" onclick="MM_openBrWindow('job/jobpost.php?jobid=<? echo "$jobid"; ?>','','width=720')"> <? echo "$j_position";?></a></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$level";?> </td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$c_name";?><br> <i><? echo "$cperson";?></i></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$nconsidered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$considered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$scheduled";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$interviewed";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$blocked";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$cv";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$j_status";?></td> <? echo "<td align='center' bgcolor='#FFFFCC'><a href='jobmngr.php?id=3&jobid=$jobid' class='link1'>edit</a> | <a href='jobmngr.php?id=4&jobid=$jobid' class='link1'>applications</a> </td></tr>"; ?> <? } ?> <tr> <td colspan="13" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> </form> <tr> <td colspan="13"> </td> </tr> </table> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td><img src="../images/spacer.gif" width="6" height="10"></td> </tr> </table> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> need help. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196106 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 OK... here is the problem $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set use this:: $test->result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196115 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 hi, its working now but i got a problem because this is file is view.php and it is just included in jobmngr.php with an id=2 how do i fix the link in such a way that the link will be http://www.jobhirings.com/admean/jobmngr.php?id=2&sort1=date_posted&sort2=ASC&Submit=Go instead of http://www.jobhirings.com/admean/jobmngr.php?sort1=date_posted&sort2=ASC&Submit=Go below is the current code of my view.php <?php session_start(); if (session_is_registered("username")){ include($_SERVER['DOCUMENT_ROOT']."/admean/pagina/my_pagina_class.php"); if(isset($_GET['sort1']) && $_GET['sort1']!='') $sort1 = $_GET['sort1']; else $sort1 = "j_position"; if(isset($_GET['sort2']) && $_GET['sort2']!='') $sort2 = $_GET['sort2']; else $sort2 = "ASC"; $test = new JHpage; $test->sql = "SELECT * FROM job_ads ORDER BY ".$sort1 ." ".$sort2.""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/spacer.gif" width="6" height="10"></td> <td><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"> <table width="1049" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="13"><table width="616" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="329" class="text6"> <?php echo " total record found: " .$total_recs; ?></td> <td width="287"> </td> </tr> </table></td> </tr> <tr> <td colspan="13"><form method="get" action="jobmngr.php?id=2"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="783"> </td> <td width="262" class="text6">sort by : <select name="sort1"> <option value="j_position">name</option> <option value="jobid">ID</option> <option value="date_posted">date</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table></form></td> </tr> <form action="jobrepost.php" method="post"> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8">| <a href="repost" class="link2">repost</a> | <a href="open" class="link2">open</a> | <a href="close" class="link2">close</a> | </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> <tr> <td width="29" align="center" bgcolor="#83C2ED" class="text5"> </td> <td width="51" align="center" bgcolor="#83C2ED" class="text5">ID</td> <td width="230" align="center" valign="top" bgcolor="#83C2ED" class="text5">title</td> <td width="140" align="center" bgcolor="#83C2ED" class="text5">level </td> <td width="254" align="center" bgcolor="#83C2ED" class="text5">client</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">N</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">C</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">S</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">I</td> <td width="24" align="center" bgcolor="#83C2ED" class="text5">B</td> <td width="28" align="center" bgcolor="#83C2ED" class="text5">CV</td> <td width="60" align="center" bgcolor="#83C2ED" class="text5">status</td> <td width="105" bgcolor="#83C2ED"> </td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $level = mysql_result($result, $i, "level"); $c_name = mysql_result($result, $i, "c_name"); $cperson = mysql_result($result, $i, "cperson"); $nconsidered = mysql_result($result, $i, "nconsidered"); $considered = mysql_result($result, $i, "considered"); $scheduled = mysql_result($result, $i, "scheduled"); $interviewed = mysql_result($result, $i, "interviewed"); $blocked = mysql_result($result, $i, "blocked"); $cv = mysql_result($result, $i, "cv"); $j_status = mysql_result($result, $i, "j_status"); ?> <tr> <td bgcolor="#FFFFCC" class="text8"><span class="text5"> <input type="checkbox" name="checkbox[]" value="<? echo"jobid"; ?>" /> </span></td> <td bgcolor="#FFFFCC" class="text8">J<? echo ($jobid <= 9) ? $jobid : $jobid;?> </td> <td bgcolor="#FFFFCC"> <a href="javascript:;" target="_blank" class="link1" onclick="MM_openBrWindow('job/jobpost.php?jobid=<? echo "$jobid"; ?>','','width=720')"> <? echo "$j_position";?></a></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$level";?> </td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$c_name";?><br> <i><? echo "$cperson";?></i></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$nconsidered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$considered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$scheduled";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$interviewed";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$blocked";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$cv";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$j_status";?></td> <? echo "<td align='center' bgcolor='#FFFFCC'><a href='jobmngr.php?id=3&jobid=$jobid' class='link1'>edit</a> | <a href='jobmngr.php?id=4&jobid=$jobid' class='link1'>applications</a> </td></tr>"; ?> <? } ?> <tr> <td colspan="13" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> </form> <tr> <td colspan="13"> </td> </tr> </table> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td><img src="../images/spacer.gif" width="6" height="10"></td> </tr> </table> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> need help on this please! thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196122 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 where are you making this link Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196129 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 from jobmngr.php view.php is included in this page where the id of view.php in jobmngr.php is 2 thats why if you notice in my action on my form its pointing to jobmngr.php?id=2 need help. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196136 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 this is the code in my jobmngr.php <? $id = $_GET['id']; { $job = 'job/view.php'; if ($id=='1') {$job = 'job/add.php';} if ($id=='2') {$job = 'job/view.php';} if ($id=='3') {$job = 'job/edit.php';} if ($id=='4') {$job = 'job/application.php';} } ?> <? include ($job); ?> and this is the code in my view.php <?php session_start(); if (session_is_registered("username")){ include($_SERVER['DOCUMENT_ROOT']."/admean/pagina/my_pagina_class.php"); if(isset($_GET['sort1']) && $_GET['sort1']!='') $sort1 = $_GET['sort1']; else $sort1 = "j_position"; if(isset($_GET['sort2']) && $_GET['sort2']!='') $sort2 = $_GET['sort2']; else $sort2 = "ASC"; $test = new JHpage; $test->sql = "SELECT * FROM job_ads ORDER BY ".$sort1 ." ".$sort2.""; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <script type="text/JavaScript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="../images/spacer.gif" width="6" height="10"></td> <td><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> <td width="214" valign="top"> <table width="1049" border="0" cellspacing="2" cellpadding="0"> <tr> <td colspan="13"><table width="616" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="329" class="text6"> <?php echo " total record found: " .$total_recs; ?></td> <td width="287"> </td> </tr> </table></td> </tr> <tr> <td colspan="13"><form method="get" action="jobmngr.php"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="783"> </td> <td width="262" class="text6">sort by : <select name="sort1"> <option value="j_position">name</option> <option value="jobid">ID</option> <option value="date_posted">date</option> </select> <select name="sort2"> <option value="ASC">ASC</option> <option value="DESC">DESC</option> </select> <input type="submit" name="Submit" value="Go" /> </td> </tr> </table></form></td> </tr> <form action="jobrepost.php" method="post"> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8">| <a href="repost" class="link2">repost</a> | <a href="open" class="link2">open</a> | <a href="close" class="link2">close</a> | </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> <tr> <td width="29" align="center" bgcolor="#83C2ED" class="text5"> </td> <td width="51" align="center" bgcolor="#83C2ED" class="text5">ID</td> <td width="230" align="center" valign="top" bgcolor="#83C2ED" class="text5">title</td> <td width="140" align="center" bgcolor="#83C2ED" class="text5">level </td> <td width="254" align="center" bgcolor="#83C2ED" class="text5">client</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">N</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">C</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">S</td> <td width="25" align="center" bgcolor="#83C2ED" class="text5">I</td> <td width="24" align="center" bgcolor="#83C2ED" class="text5">B</td> <td width="28" align="center" bgcolor="#83C2ED" class="text5">CV</td> <td width="60" align="center" bgcolor="#83C2ED" class="text5">status</td> <td width="105" bgcolor="#83C2ED"> </td> </tr> <?php for ($i = 0; $i < $num_rows; $i++) { $jobid = mysql_result($result, $i, "jobid"); $j_position = mysql_result($result, $i, "j_position"); $level = mysql_result($result, $i, "level"); $c_name = mysql_result($result, $i, "c_name"); $cperson = mysql_result($result, $i, "cperson"); $nconsidered = mysql_result($result, $i, "nconsidered"); $considered = mysql_result($result, $i, "considered"); $scheduled = mysql_result($result, $i, "scheduled"); $interviewed = mysql_result($result, $i, "interviewed"); $blocked = mysql_result($result, $i, "blocked"); $cv = mysql_result($result, $i, "cv"); $j_status = mysql_result($result, $i, "j_status"); ?> <tr> <td bgcolor="#FFFFCC" class="text8"><span class="text5"> <input type="checkbox" name="checkbox[]" value="<? echo"jobid"; ?>" /> </span></td> <td bgcolor="#FFFFCC" class="text8">J<? echo ($jobid <= 9) ? $jobid : $jobid;?> </td> <td bgcolor="#FFFFCC"> <a href="javascript:;" target="_blank" class="link1" onclick="MM_openBrWindow('job/jobpost.php?jobid=<? echo "$jobid"; ?>','','width=720')"> <? echo "$j_position";?></a></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$level";?> </td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$c_name";?><br> <i><? echo "$cperson";?></i></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$nconsidered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$considered";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$scheduled";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$interviewed";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$blocked";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$cv";?></td> <td bgcolor="#FFFFCC" class="text8"> <? echo "$j_status";?></td> <? echo "<td align='center' bgcolor='#FFFFCC'><a href='jobmngr.php?id=3&jobid=$jobid' class='link1'>edit</a> | <a href='jobmngr.php?id=4&jobid=$jobid' class='link1'>applications</a> </td></tr>"; ?> <? } ?> <tr> <td colspan="13" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td> </tr> <tr> <td colspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60%" align="left" class="text8"> </td> <td width="39%" align="right"><!-- nav top --> <? echo "<span class='link1'>".$nav_links."</span>"; ?> </td> <td width="1%" align="right"><img src="images/spacer.gif" width="12" height="10" /></td> </tr> </table></td> </tr> </form> <tr> <td colspan="13"> </td> </tr> </table> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1"></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1"></td> </tr> </table></td> <td><img src="../images/spacer.gif" width="6" height="10"></td> </tr> </table> <? }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> what i wanted to happen is to have the link be http://www.jobhirings.com/admean/jobmngr.php?id=2&sort1=date_posted&sort2=ASC&Submit=Go instead of http://www.jobhirings.com/admean/jobmngr.php?sort1=date_posted&sort2=ASC&Submit=Go because with the current code that i have, the link that i am getting is http://www.jobhirings.com/admean/jobmngr.php?sort1=date_posted&sort2=ASC&Submit=Go hope you could help me with this. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196146 Share on other sites More sharing options...
itsmeArry Posted February 28, 2007 Share Posted February 28, 2007 wht you can do is call a javascript function on form submit e.g. //change the form like this...... "<form method="get" action="jobmngr.php" onSubmit="return frmSubmit();"> //add this script.... <script language="javascript"> function frmSubmit() { var sort1 = document.forms[0].sort1.value; var sort2 = document.forms[0].sort2.value; document.forms[0].action = "jobmngr.php?id=2&sort1="+sort1+"&sort2="+sort2+"&Submit=Go"; document.forms[0].submit(); } </script> hope this will help......... Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196147 Share on other sites More sharing options...
pixeltrace Posted February 28, 2007 Author Share Posted February 28, 2007 its working now. thanks to all the help!!!! Quote Link to comment https://forums.phpfreaks.com/topic/40513-solved-need-help-on-drop-down-menu-option/#findComment-196159 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.