Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-07-2012, 06:17 AM   PM User | #1
sith06j
New to the CF scene

 
Join Date: Sep 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sith06j is an unknown quantity at this point
How to highlight AJAX search result in a check box list

I have a check box list of students and a search box in first php page .In ajax page I will get the search results .

But the problem is ,if user selected first search result and searched again selection on the first search is lost


How can I save selections on the first search ?I have tried to make selections in an session array but it is not working
PHP Code:
    //check list
        
$qry="select cand_id,name from candidate where inst_id=".$_SESSION['inst_id']."";
        
$res=$ob->select($qry,$connect);
        while(
$rw=pg_fetch_row($res))
        {
            
            echo
"<br><input type=\"checkbox\" name=\"check[]\" value=\"$rw[0]\">";echo$rw[1];echo"<br>" ;
        }
    
//Ajax page
    
if($ajaxData!="")
    {
                                    if(
$_SESSION['usertype_id']==1)
                                    {
                                    
$qry="select cand_id,name from candidate where name like'$dataup%'  ";
                                    
                                    }
                                    else if(
$_SESSION['usertype_id']==2)
                                    {
                                    
$qry="select cand_id,name from candidate where inst_id=".$_SESSION['inst_id']."
                                    and  name like'$dataup%' "
;
                                    }
                                    
$res=$ob->select($qry,$connect);
                                    
$words=array();
                                    
$count pg_num_rows($res);
                                    if(
$count>0)
                                    {
                                        
$i=0;
                                        
//echo"<div  style=\"width: 200px; height: 200px;overflow-y: auto;padding-top: 10px;padding-right: 0px;padding-bottom: 0.25in;\">";
                                        
while($rw=pg_fetch_row($res))
                                        {
                                            
$words[$i]=$rw[0];$i++;
                                            
                                            
                                        }

                                        
$_SESSION['checkAjax']=$words;//can_id array 
1. How do I use array $_SESSION['checkAjax'] for highlighting?
2. Why $_SESSION['checkAjax'] unset on each ajax call?
3. Just need change of color on selected student names
sith06j is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:45 PM.


Advertisement
Log in to turn off these ads.