11
neda_barna
Re: combo box
  • 2007/9/24 11:03

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


this problem solved
thx for your guide

12
script_fu
Re: combo box

Quote:

kaotik wrote:
script_fu: I'm curious about your garage project Did you start this module based on my tutorials?


Not the one we have now. I sure have learned from your tuts. I will be starting a new module based on your code and this code here. The new module will be called cars or requester.

Year, make and model will be the main focus of the new module as a way to populate the database.

13
script_fu
Re: combo box

Quote:

neda_barna wrote:
this problem solved
thx for your guide


Can you post your finished code? So the community may benifit.

14
script_fu
Re: combo box

Quote:

neda_barna wrote:
this problem solved
thx for your guide


I hate when this happens. Its like the users gets what he needs from the help people give. But never posts the full answer to the question.

Can a dev post the finished code please?

15
neda_barna
Re: combo box
  • 2007/9/25 4:53

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


ok i send for u
this is my code
i have 1 problem
please see a segment that elseif ($_POST['referee']=='B')
because my actin is expire_date it dosent work
why??
if we have 2 that action of that is equal is it problem????????
include_once ( "header.php" );
include_once ( 
XOOPS_ROOT_PATH."/class/xoopsformloader.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/journal_referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_paper.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_record.php" );
//include_once ( XOOPS_ROOT_PATH."/class/xoopsobject.php" );
//------------------Function referrlist

    
function refereeList$case$case_next NULL$sid NULL$withcheck FALSE  ){
    
    global 
$query$order$start$limit;

        
  
$referee_r JournalReferee::getAll$queryTRUE$order$limit$start );
    
//echo '
'; print_r( $referee_r ); echo '
'; // !!!!!!!!!! DEBUG !!!!!!!!!!!!!
    
    
$action ='extended_expire.php';
        
//$action = 'referee.php?case='.$case_next.'&case_pre='.$case.'&order='.$order.'"';
    //if ( $sid ) { $action.= '&sid='.$sid; }
 
    
$total JournalReferee::getCountAll$query ); // DEBUG!!
    //$total = count( JournalReferee::getAll( $query, FALSE ) );
    

 

        
$content '.$action.'" method="post">
          ';
    if ( 
$withcheck ) {
        
$content.= '';
        }
    
$content.= ''._REF_NAME.'
        '
._REF_FIELD.'
        '
._REF_EMAIL.'
            '
._REF_STATUS;
    
    
// --- Status Description --- Referee's staus desc in brief !    
    
if ( ) {
                } elseif ( 
) {
                } elseif ( 
) {
                } else {
            
$content.= ''._REF_ASSIGN_JOB.' '._REF_CHAR_PIPE.'
                 '
._REF_ASSIGN_EXP.' '._REF_CHAR_PIPE.
                 '
._REF_ASSIGN_FIN.'
';
        }

    
$content.= '';
    
        
$class 'even';

        foreach ( 
$referee_r as $referee ) {

                
$uid $referee->getVar'uid' );
                
$name $referee->getVar'name' );
                
$email $referee->getVar'email' );
                
$status $referee->getStatus();
        
        
$field substr_words$referee->getVar'bio' ), );

        if ( 
) {
                } elseif ( 
) {
        } elseif ( 
) {
        } else {
            
$_status '
            
            
            
            
'.$status'assign' ].' '._REF_CHAR_PIPE. '.$status'expire' ].' '._REF_CHAR_PIPE. '.$status'finish' ].'
'
;
        }
    
                
//$date = formatTimestamp ( $paper->getVar( 'date' ), 's' );
        
$class = ($class == 'odd') ? 'even' 'odd';
                
        
$content.= '';
        if ( 
$withcheck ) {
            
$content.= '.$uid.'"';    
        }
        
$content.= '
                    .$class.'">'.$name.'
                    .$class.'">'.$field.'
            .$class.'">'.$email.'
                    .$class.'">'.$_status.'
            '
;
                
$content.= '';

        }
           
$content.= ''
        if ( 
$withcheck ) {
              
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;
                          
$content.= '
              '
._REF_EXP.': 

    '
;

 
    
//$form.=    '  ';
    
     
$content.=' ._REF_SAVE.'" />

          '
;
    

        
               
//$content.= '
        //$content.= '    ';
        
}   
    
$content.= '';
    
    return 
$head.$content;

}
//----------------------------End Function

include_once ( XOOPS_ROOT_PATH."/header.php" );
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;



$caption '

            

        
'._REF_CHANGE.
'
;
$combo '
           
          
           _________ 
           '
._REF_LIST_ALLA.'
           '
._REF_LIST_KOL.'
           '
._REF_LIST_UNIQE.'
             '
;
 
$combo .=' ._REF_BUTTON_GO.'" />
          
          '
;
echo 
$caption;
echo 
$combo;


if (
$_POST['referee']=='A')
{

echo 
$form;
echo 
refereeList'referee''assign'$sidTRUE  );
} elseif (
$_POST['referee']=='B')
{
$form1 '

    
     '
._REF_EXP.': 

    '
;
    
//$form.=    '  ';
    
$form1 .=    ' ._REF_SAVE.'" />


        
                '
;
echo 
$form1;
$word=$_POST['key'];
$word1=$word 86400;
// $xoopsDB->query("UPDATE ".$xoopsDB->prefix ( refree )." SET exp_date = exp_date +$word1 ");
$query="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE 1";
$xoopsDB->query($query);
if(
$xoopsDB->query($query)){
echo 
"Data was correctly inserted into DB!";
}  
}
//-------------------------------------
foreach ($_POST['check'] as $chk)
{
$word=$_POST['key'];
$word1=$word 86400;
$query="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE uid='$chk'  ";
$res=$xoopsDB->query($query);
if(
$res){
echo 
"Data was correctly inserted into DB!";
}
}




//------------------------------
//-------------------combo box
/**if ($_POST['referee']=='A')
{
//do something
} elseif ($_POST['referee']=='B')
{
//do something
} elseif ($_POST['referee']=='C')
{
//do something
}**/    
include_once ( XOOPS_ROOT_PATH."/footer.php" );
?>

16
kaotik
Re: combo box
  • 2007/9/25 9:30

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I don't understand your question, but I do see an error in your code:

Replace:
$xoopsDB->prefix referee )


with:
$xoopsDB->prefix "referee" )


you forgot to place quotes on your table name

17
neda_barna
Re: combo box
  • 2007/9/25 10:20

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


in part 1 :if ($_POST['referee']=='A')
i call a function then i have 1 form for combo box and 1 form for function

in part 2 :if ($_POST['referee']=='B')
i have 2 form 1 form for combo box and 1 form for textbox and button

now if i write code of part 2 in another file my program
working but in main file it dosent working
now if my code become like this it workin
extended_expire.php
include_once ( "header.php" );
include_once ( 
XOOPS_ROOT_PATH."/class/xoopsformloader.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/journal_referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_paper.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_record.php" );
include_once ( 
REFER_ROOT_PATH."/class/list.php" );
//include_once ( XOOPS_ROOT_PATH."/class/xoopsobject.php" );
//------------------Function referrlist

    
function refereeList$case$case_next NULL$sid NULL$withcheck FALSE  ){
    
    global 
$query$order$start$limit;

        
  
$referee_r JournalReferee::getAll$queryTRUE$order$limit$start );
    
//echo '
'; print_r( $referee_r ); echo '
'; // !!!!!!!!!! DEBUG !!!!!!!!!!!!!
    
    
$action ='extended_expire.php';
        
//$action = 'referee.php?case='.$case_next.'&case_pre='.$case.'&order='.$order.'"';
    //if ( $sid ) { $action.= '&sid='.$sid; }
 
    
$total JournalReferee::getCountAll$query ); // DEBUG!!
    //$total = count( JournalReferee::getAll( $query, FALSE ) );
    

 

        
$content '.$action.'" method="post">
          ';
    if ( 
$withcheck ) {
        
$content.= '';
        }
    
$content.= ''._REF_NAME.'
        '
._REF_FIELD.'
        '
._REF_EMAIL.'
            '
._REF_STATUS;
    
    
// --- Status Description --- Referee's staus desc in brief !    
    
if ( ) {
                } elseif ( 
) {
                } elseif ( 
) {
                } else {
            
$content.= ''._REF_ASSIGN_JOB.' '._REF_CHAR_PIPE.'
                 '
._REF_ASSIGN_EXP.' '._REF_CHAR_PIPE.
                 '
._REF_ASSIGN_FIN.'
';
        }

    
$content.= '';
    
        
$class 'even';

        foreach ( 
$referee_r as $referee ) {

                
$uid $referee->getVar'uid' );
                
$name $referee->getVar'name' );
                
$email $referee->getVar'email' );
                
$status $referee->getStatus();
        
        
$field substr_words$referee->getVar'bio' ), );

        if ( 
) {
                } elseif ( 
) {
        } elseif ( 
) {
        } else {
            
$_status '
            
            
            
            
'.$status'assign' ].' '._REF_CHAR_PIPE. '.$status'expire' ].' '._REF_CHAR_PIPE. '.$status'finish' ].'
'
;
        }
    
                
//$date = formatTimestamp ( $paper->getVar( 'date' ), 's' );
        
$class = ($class == 'odd') ? 'even' 'odd';
                
        
$content.= '';
        if ( 
$withcheck ) {
            
$content.= '.$uid.'"';    
        }
        
$content.= '
                    .$class.'">'.$name.'
                    .$class.'">'.$field.'
            .$class.'">'.$email.'
                    .$class.'">'.$_status.'
            '
;
                
$content.= '';

        }
           
$content.= ''
        if ( 
$withcheck ) {
              
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;
                          
$content.= '
              '
._REF_EXP.': 

    '
;

 
    
//$form.=    '  ';
    
     
$content.=' ._REF_SAVE.'" />

          '
;
    

        
               
//$content.= '
        //$content.= '    ';
        
}   
    
$content.= '';
    
    return 
$head.$content;

}
//----------------------------End Function

include_once ( XOOPS_ROOT_PATH."/header.php" );
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;


    
//$form.=    '  ';
    
$form1 .=    ' ._REF_SAVE.'" />


        
                '
;

$caption '

            

        
'._REF_CHANGE.
'
;
$combo '
           
          
           _________ 
           '
._REF_LIST_ALLA.'
           '
._REF_LIST_KOL.'
           '
._REF_LIST_REF.'
             '
;
 
$combo .=' ._REF_BUTTON_GO.'" />
          
          '
;
echo 
$caption;
echo 
$combo;
$list1'

'._REF_SAVE1.'

'
;

if (
$_POST['referee']=='A')
{

echo 
$form;
echo 
refereeList'referee''assign'$sidTRUE  );

} elseif (
$_POST['referee']=='B')
{
$form1 '

    
     '
._REF_EXP.': 

    '
;
    
//$form.=    '  ';
    
$form1 .=    ' ._REF_SAVE.'" />


        
                '
;
echo 
$form1;


}



elseif (
$_POST['referee']=='C')
{







}

//-------------------------------------
foreach ($_POST['check'] as $chk)
{
$word=$_POST['key'];
$word1=$word 86400;
$query1="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE uid='$chk'  ";
$res=$xoopsDB->query($query1);
if(
$res){

echo 
$list1;
}
}




//------------------------------
//-------------------combo box
/**if ($_POST['referee']=='A')
{
//do something
} elseif ($_POST['referee']=='B')
{
//do something
} elseif ($_POST['referee']=='C')
{
//do something
}**/    
include_once ( XOOPS_ROOT_PATH."/footer.php" );
?>


extended_expire1.php
include_once ( "header.php" );
include_once ( 
XOOPS_ROOT_PATH."/header.php" );
include_once ( 
XOOPS_ROOT_PATH."/class/xoopsformloader.php" );
//include_once ( REFER_ROOT_PATH."/class/referee_paper.php" );
 
$form1 '';

    
    
$form1 .=    ' ._REF_RETURN.'" />


        
                '
;

    
       
$list'

'._REF_SAVE1.'

'
;
$word=$_POST['key'];
$word1=$word 86400;
// $xoopsDB->query("UPDATE ".$xoopsDB->prefix ( refree )." SET exp_date = exp_date +$word1 ");
$query="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE 1";
$res=$xoopsDB->query($query);
if(
$res){
echo 
$list;
echo 
$form1;

    

include_once ( 
XOOPS_ROOT_PATH."/footer.php" );
?>

it work

but if my code become like this
segment of if ($_POST['referee']=='B')
dont work
include_once ( "header.php" );
include_once ( 
XOOPS_ROOT_PATH."/class/xoopsformloader.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/journal_referee.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_paper.php" );
include_once ( 
REFER_ROOT_PATH."/class/referee_record.php" );
include_once ( 
REFER_ROOT_PATH."/class/list.php" );
//include_once ( XOOPS_ROOT_PATH."/class/xoopsobject.php" );
//------------------Function referrlist

    
function refereeList$case$case_next NULL$sid NULL$withcheck FALSE  ){
    
    global 
$query$order$start$limit;

        
  
$referee_r JournalReferee::getAll$queryTRUE$order$limit$start );
    
//echo '
'; print_r( $referee_r ); echo '
'; // !!!!!!!!!! DEBUG !!!!!!!!!!!!!
    
    
$action ='extended_expire.php';
        
//$action = 'referee.php?case='.$case_next.'&case_pre='.$case.'&order='.$order.'"';
    //if ( $sid ) { $action.= '&sid='.$sid; }
 
    
$total JournalReferee::getCountAll$query ); // DEBUG!!
    //$total = count( JournalReferee::getAll( $query, FALSE ) );
    

 

        
$content '.$action.'" method="post">
          ';
    if ( 
$withcheck ) {
        
$content.= '';
        }
    
$content.= ''._REF_NAME.'
        '
._REF_FIELD.'
        '
._REF_EMAIL.'
            '
._REF_STATUS;
    
    
// --- Status Description --- Referee's staus desc in brief !    
    
if ( ) {
                } elseif ( 
) {
                } elseif ( 
) {
                } else {
            
$content.= ''._REF_ASSIGN_JOB.' '._REF_CHAR_PIPE.'
                 '
._REF_ASSIGN_EXP.' '._REF_CHAR_PIPE.
                 '
._REF_ASSIGN_FIN.'
';
        }

    
$content.= '';
    
        
$class 'even';

        foreach ( 
$referee_r as $referee ) {

                
$uid $referee->getVar'uid' );
                
$name $referee->getVar'name' );
                
$email $referee->getVar'email' );
                
$status $referee->getStatus();
        
        
$field substr_words$referee->getVar'bio' ), );

        if ( 
) {
                } elseif ( 
) {
        } elseif ( 
) {
        } else {
            
$_status '
            
            
            
            
'.$status'assign' ].' '._REF_CHAR_PIPE. '.$status'expire' ].' '._REF_CHAR_PIPE. '.$status'finish' ].'
'
;
        }
    
                
//$date = formatTimestamp ( $paper->getVar( 'date' ), 's' );
        
$class = ($class == 'odd') ? 'even' 'odd';
                
        
$content.= '';
        if ( 
$withcheck ) {
            
$content.= '.$uid.'"';    
        }
        
$content.= '
                    .$class.'">'.$name.'
                    .$class.'">'.$field.'
            .$class.'">'.$email.'
                    .$class.'">'.$_status.'
            '
;
                
$content.= '';

        }
           
$content.= ''
        if ( 
$withcheck ) {
              
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;
                          
$content.= '
              '
._REF_EXP.': 

    '
;

 
    
//$form.=    '  ';
    
     
$content.=' ._REF_SAVE.'" />

          '
;
    

        
               
//$content.= '
        //$content.= '    ';
        
}   
    
$content.= '';
    
    return 
$head.$content;

}
//----------------------------End Function

include_once ( XOOPS_ROOT_PATH."/header.php" );
$form'
             '
._REF_ASSIGN_ALLLIST.'
               '
;


    
//$form.=    '  ';
    
$form1 .=    ' ._REF_SAVE.'" />


        
                '
;

$caption '

            

        
'._REF_CHANGE.
'
;
$combo '
           
          
           _________ 
           '
._REF_LIST_ALLA.'
           '
._REF_LIST_KOL.'
           '
._REF_LIST_REF.'
             '
;
 
$combo .=' ._REF_BUTTON_GO.'" />
          
          '
;
echo 
$caption;
echo 
$combo;
$list1'

'._REF_SAVE1.'

'
;

if (
$_POST['referee']=='A')
{

echo 
$form;
echo 
refereeList'referee''assign'$sidTRUE  );

} elseif (
$_POST['referee']=='B')
{
$form1 '

    
     '
._REF_EXP.': 

    '
;
    
//$form.=    '  ';
    
$form1 .=    ' ._REF_SAVE.'" />


        
                '
;
echo 
$form1;

$word=$_POST['key'];
$word1=$word 86400;
// $xoopsDB->query("UPDATE ".$xoopsDB->prefix ( refree )." SET exp_date = exp_date +$word1 ");
$query1="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE 1";
$res=$xoopsDB->query($query);
if(
$res){

echo 
$list1;

}  
}



elseif (
$_POST['referee']=='C')
{







}

//-------------------------------------
foreach ($_POST['check'] as $chk)
{
$word=$_POST['key'];
$word1=$word 86400;
$query1="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE uid='$chk'  ";
$res=$xoopsDB->query($query1);
if(
$res){

echo 
$list1;
}
}




//------------------------------
//-------------------combo box
/**if ($_POST['referee']=='A')
{
//do something
} elseif ($_POST['referee']=='B')
{
//do something
} elseif ($_POST['referee']=='C')
{
//do something
}**/    
include_once ( XOOPS_ROOT_PATH."/footer.php" );
?>

18
script_fu
Re: combo box

bump

19
kaotik
Re: combo box
  • 2007/9/26 9:19

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


Ok, a couple of things:
replace:
$query1="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word1' WHERE 1";
$res=$xoopsDB->query($query);


with:
$query1="UPDATE ".$xoopsDB->prefix ( [color=990000]"[/color]referee[color=990000]"[/color] )." SET exp_date = exp_date + '$word1' WHERE 1";
$res=$xoopsDB->query([color=990000]$query1[/color]);


-On the first line you used $query1 but in the second you used $query
- You should place the table name in quotes, otherwise PHP will interpret it as a constant.

Login

Who's Online

292 user(s) are online (214 user(s) are browsing Support Forums)


Members: 0


Guests: 292


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits