vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   How do I fix this problem? (https://vborg.vbsupport.ru/showthread.php?t=230139)

vietfancy 12-13-2009 09:19 PM

How do I fix this problem?
 
This code below seems to work just fine except for when edit and update it just go back to 1 page.

ex: when I view do=sat after edit and update a class ... it redirect back to do=fri. How do I keep it stay in do=sat?

I know the code tell it to go back to do=fri is:
PHP Code:

print_cp_message('Class has been updated''schedule.php?do=' iif($type==1,'fri')); 

but how do I fix it?

Thanks.

here is the code.

PHP Code:

if($_REQUEST['do'] == 'fri'){
    
print_form_header('schedule''delete'falsetrue'delete''90%'''true'post'0);
    
print_table_header("Friday Classes",6);

    
$items $db->query_read("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE day = 'friday' AND live = '1'
            ORDER BY time
    "
);    
    
$i    1;
    if(
$db->num_rows($items))
    while(
$item $db->fetch_array($items))
    {
        if(
$i%2==0$class 'alt2'; else $class 'alt1';
        echo 
'<tr class="' $class '">
            <td align="center" class="smallfont">'
htmlspecialchars($item['class']) .' <a href="schedule.php?do=edit&scheduleid=' $item['id'] . '&type=1" title="Edit"><img title="Edit Class" alt="Edit Class" src="../images/misc/userfield_edit.gif" border="0" hspace="6"></a></td>
        </tr>'
;    
        
$i++;
    }
    else echo 
'<tr class="alt1"><td align="center" colspan="6">No Class Found!</td></tr>';
    
$db->free_result($items);
    
print_submit_row('Delete" onclick="return confirm(\'Are you sure you want to delete?\')''Reset'6''''false); 
    
print_cp_footer();
}
//Sat
if($_REQUEST['do'] == 'sat'){
    
print_form_header('schedule''delete'falsetrue'delete''90%'''true'post'0);
    
print_table_header("Saturday Classes",6);

    
$items $db->query_read("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE day = 'saturday' AND live = '1'
            ORDER BY time
    "
);    
    
$i    1;
    if(
$db->num_rows($items))
    while(
$item $db->fetch_array($items))
    {
        if(
$i%2==0$class 'alt2'; else $class 'alt1';
        echo 
'<tr class="' $class '">
            <td align="center" class="smallfont">'
htmlspecialchars($item['class']) .' <a href="ese_schedule.php?do=edit&scheduleid=' $item['id'] . '&type=1" title="Edit"><img title="Edit Class" alt="Edit Class" src="edit.gif" border="0" hspace="6"></a></td>
        </tr>'
;    
        
$i++;
    }
    else echo 
'<tr class="alt1"><td align="center" colspan="6">No Class Found!</td></tr>';
    
$db->free_result($items);
    
print_submit_row('Delete" onclick="return confirm(\'Are you sure you want to delete?\')''Reset'6''''false); 
    
print_cp_footer();
}

if(
$_REQUEST['do']=='edit'){
    
$scheduleid $vbulletin->input->clean_gpc('r','scheduleid',TYPE_INT);
    
$type $vbulletin->input->clean_gpc('r','type',TYPE_INT);
    
$item $db->query_first("
            SELECT *
            FROM " 
TABLE_PREFIX "table
            WHERE id = 
$scheduleid
    "
);        
    
print_form_header('schedule''update');
    
construct_hidden_code('scheduleid'$scheduleid);
    
construct_hidden_code('type'$type);
    
print_hidden_fields();        
    
print_table_header('Editing Class');
    
print_input_row('Class:''class'$item['class']);
    
print_submit_row('Save');
    
print_cp_footer();        
}
if(
$_REQUEST['do']=='update'){
    
$scheduleid $vbulletin->input->clean_gpc('p','scheduleid',TYPE_INT);
    
$class $vbulletin->input->clean_gpc('p','class',TYPE_STR);
    
$type $vbulletin->input->clean_gpc('p','type',TYPE_INT);
    
$extra "";
    
$item $db->query_write("
            UPDATE " 
TABLE_PREFIX "table
            SET class = '" 
$db->escape_string($class) . "'$extra
            WHERE id = 
$scheduleid
    "
);            
    
print_cp_message('Class has been updated''schedule.php?do=' iif($type==1,'fri'));




All times are GMT. The time now is 08:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01376 seconds
  • Memory Usage 1,764KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete