Jump to content

drop down menu not working


pixeltrace

Recommended Posts

guys,

 

i need help, i have a view page that has a drop down menu on the top wherein you can view the result with conditions

set on the drop down menus.

 

my problem now, its not working and it always give me a (0) result

 

below is my codes for the view page. hope you could help me fix it.

<?php
session_start();

if (session_is_registered("username")){
$jobid = $_GET[jobid];

include("pagina/my_pagina_class.php");

$special = '';
if (isset($_GET['astatus'])) {
  if($_GET['astatus'] != ''){
    $special = "AND a_status LIKE '%". $_GET['astatus'] ."%'";
  }
}

if(isset($_GET['sort1']) && $_GET['sort1']!='')
     $sort1 = $_GET['sort1'];
else
     $sort1 = "appid";


if(isset($_GET['sort2']) && $_GET['sort2']!='')
     $sort2 = $_GET['sort2'];
else
     $sort2 = "ASC";	 

$test = new JHpage;
$test->sql = "SELECT * FROM applicantjob WHERE jobid = '$jobid' ".$special." 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="897" border="0" cellspacing="2" cellpadding="0">
            <tr>
              <td colspan="6" align="right"><form method="get" action="sjobs.php?id=<? echo "$id"; ?>">
<input name="id" type="hidden" value="3" />
		  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="407"><span class="text6">
                      <?php
				 echo "   total record found: " .$total_recs; ?>
                    </span></td>
                    <td width="486" align="right" class="text6">sort by :
                      <select name="astatus">
                        <option value="">select status</option>
                        <option value="waiting" selected>waiting</option>
                        <option value="notconsidered">not considered</option>
                        <option value="considered">considered</option>
                        <option value="scheduled">scheduled</option>
                        <option value="interviewed">interviewed</option>
                        <option value="blocked">blacklisted</option>
                      </select>
                       
                      <select name="sort1">
<option value="">select category</option>
<option value="appid" selected>ID</option>
<option value="username">username</option>
<option value="date_applied">date applied</option>
</select>
                       
                      <select name="sort2">
  <option value="ASC" selected>ASC</option>
  <option value="DESC">DESC</option>
</select>
<input type="submit" name="Submit" value="Go" />
   </td>
                  </tr>
              </table>
              </form></td>
            </tr>
            		
<tr>
              	<td colspan="6"><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>
            <tr>
              <td width="68" align="center" bgcolor="#83C2ED" class="text5">ID</td>
              <td width="320" align="center" valign="top" bgcolor="#83C2ED" class="text5">username</td>
              <td width="220" align="center" bgcolor="#83C2ED" class="text5">application status </td>
              <td width="163" align="center" bgcolor="#83C2ED" class="text5">applied position </td>
              <td width="125" align="center" bgcolor="#83C2ED" class="text5">date applied </td>
            </tr>
<?php 
for ($i = 0; $i < $num_rows; $i++) {
$appid = mysql_result($result, $i, "appid");
$username = mysql_result($result, $i, "username");
$a_status = mysql_result($result, $i, "a_status");
$jobsapplied = mysql_result($result, $i, "jobsapplied");
$date_applied = mysql_result($result, $i, "date_applied");
?>            <tr>
              <td align="center" bgcolor="#FFFFCC" class="text8"><span class="text5">
              </span> A<? echo ($appid <= 9) ? $appid : $appid;?>				  </td>
              <td bgcolor="#FFFFCC"> <a href="javascript:;" class="link1" onClick="MM_openBrWindow('../resume/details.php?id=1&appid=<? echo "$appid"; ?>','','scrollbars=yes,width=760')">
		<? echo "$username"; ?></a></td>
              <td bgcolor="#FFFFCC" class="text8"> 
             <? echo "$a_status";?>			 </td>
              <td bgcolor="#FFFFCC" class="text8"> <? echo "$jobsapplied";?><br></td>
              <td bgcolor="#FFFFCC" class="text8"><? echo "$date_applied";?></td>
              <? echo "</td></tr>";
            ?>
     <?        
}
?>
            <tr>
              <td colspan="6" bgcolor="#83C2ED"><img src="../images/spacer.gif" width="10" height="2" /></td>
            </tr>
            <tr>
              <td colspan="6"><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>		

            <tr>
              <td colspan="6"> </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>";
}
?>

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/43227-drop-down-menu-not-working/
Share on other sites

hi,

 

this is the only part where its not working

$special = '';
if (isset($_GET['stat'])) {
  if($_GET['stat'] != ''){
    $special = " AND a_status = '". $_GET['stat'] ."'";
  }
}

 

because if i remove that and the list menu for that

<select name="stat">
                        <option value="">select status</option>
                        <option value="waiting" selected>waiting</option>
                        <option value="notconsidered">not considered</option>
                        <option value="considered">considered</option>
                        <option value="scheduled">scheduled</option>
                        <option value="interviewed">interviewed</option>
                        <option value="blocked">blacklisted</option>
                      </select>

 

my drop down is working.

maybe there just some wrong code or something that i missed there.

 

hope you could help me fix it.

 

thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.