2
Contributors
4
Replies
8
Views
6 Years
Discussion Span
Last Post by wolveirne2005
0
<option name="search[company_name]">COMPANY NAME</option>
   <option name="search[account_number]">ACCOUNT NUMBER</option>
   <option value="all">SHOW ALL</option>

should be:

<option value="company_name">COMPANY NAME</option>
   <option value="account_number">ACCOUNT NUMBER</option>
   <option value="all">SHOW ALL</option>

The select carries:

<select name="searchby" id="droplist">

On submit you pick up $_POST or $_GET, depending on the form method.
That will hold either company_name,account_number,all.
SO simple to pull out data from DB.

If you want ajax or autofill, that's something else.

Edited by diafol: n/a

0

Actually that is not working. the only thing that works is

<input type="text" name="<?php echo $_REQUEST['unisearch'];?>" class="submit" size="16">

However, the problem is I have to click the search twice to get the variable. That is the only problem I have right now. Thanks

0

Are you sending to a different page or the same one? I don't see any form tags.

The code you've posted is quite unorthodox.

But good luck with it.

0

Yes, there is form.
Basically,
<input type="text" name="<?php echo $_REQUEST;?>" class="submit" size="16">
the name needs to update as the user selects Company name or Account number, so the search function to look in that table database.

The name field for

<?php 
error_reporting(1);
if(getlevel()!="administrator"){exit;}
$search = $_REQUEST['search'];
$unisearch = $_REQUEST['search'];

$users = $module->get_users($db,$search);

?>
<style type="text/css">
tr#hide{
	display:none!important;
	visibility:hidden!important;
}

</style>
<h2><?php echo _l('All Clients'); ?></h2>

<div align="right">
	<img src="images/add.png" width="16" class="add" height="16" alt="add" border="0" /><?php echo create_link("Add New Client","add",$module->link("",array("user_id"=>"new"))); ?>
</div>

<form action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="tableclass tableclass_rows">
	<tr class="title">
		<th><?php echo _l('Company Name'); ?></th>
        <th><?php echo _l('Provider'); ?></th>
        <th><?php echo _l('Contract End'); ?></th>
        <th><?php echo _l('Account Number'); ?></th>
        <!--<th><?php echo _l('Parent'); ?></th>-->
        <th align="center"><?php echo _l('Action'); ?></th>
    </tr>

    <tr class="search">
  
        	
  	<div align="center"><br />Search:<br />
					<select name="unisearch" id="dropdown">
						<option value="search[company_name]">COMPANY NAME</option>
						<option value="search[account_number]">ACCOUNT NUMBER</option>
						<option value="all">SHOW ALL</option>
					</select>
				
					<div nowrap="nowrap"><br/ ><br />For:<br />
					<input type="text" name="<?php
					$type=$_POST['unisearch'];
					 if (isset($_POST['unisearch'])) {echo $_POST['unisearch'];}else {echo 'search[company_name]'; } ?>" 
					class="submit" size="16">
					
					<br></span><br /><?php echo create_link("Search","submit"); ?>	        <?php echo create_link("Reset","reset",$module->link()); ?>
					</div>
</div>
        
        
        <!-- <td>
        <?
        $parents = array();
		foreach($users as $u){
			if($u['parent_id']){
				$parent = $module->get_user($db,$u['parent_id']);
				$parents[$u['parent_id']] = $parent['real_name'];
			}
		}
		echo print_select_box($parents,"search[parent_id]",$search['parent_id']);
		?>
        </td> -->
        <td nowrap="nowrap">
        	
        </td>
    </tr>
    <tr class="sep" height="1">
    	<td colspan="6" height="1" align="center"></td>
    </tr>
    <?php 
    // group users by type.
	$user_types = array();
	foreach($users as $user){
		$user_types[(($user['access_level'])?$user['access_level']:"Other")][]=$user;
	}
	$c=0;
	foreach($user_types as $access_level => $users){ 
		
		foreach($users as $user){ ?>
        <tr class="<?php echo ($c++%2)?"odd":"even"; ?>" id="<?php echo $user['admin_id']; ?>">
            <td><a href="<?php echo $module->link('',array("user_id"=>$user['user_id'])); ?>"><?php echo $user['company_name']; ?></a></td>
            <td><?php echo $user['provider']; ?></td></td>
          
               <td><?php echo $user['contract_end']; ?></td>
                <td><a href="<?php echo $module->link('',array("user_id"=>$user['user_id'])); ?>"><?php echo $user['account_number']; ?></a></td>
                </td>
            <!--<td><?
            if($user['parent_id']){
			//friendly_key(get_access_levels(),friendly_key(get_user($db,$user['parent_id']),"access_level")).": ".
			 echo friendly_key(get_user($db,$user['parent_id']),"real_name");
			 }
			 ?></td> -->
            <td align="center">
            	<img src="images/open-add.png" width="18" height="18" alt="add" border="0" /><?php echo create_link("Open","open",$module->link('',array("user_id"=>$user['user_id']))); ?>
            </td>
        </tr>
        <?php } ?>
        <tr class="sep" height="1">
        	<td colspan="6" height="1" align="center"></td>
        </tr>
      <?php } ?>
</table>
</form>

Edited by wolveirne2005: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.