Hi,
I'm trying to figure out a good way to reload a page after a condition is met in a script.
case 'status':
$class_id = (!empty($HTTP_POST_VARS['id'])) ? intval($HTTP_POST_VARS['id']) : intval($HTTP_GET_VARS['id']);
$status_switch = (!empty($HTTP_POST_VARS['status'])) ? intval($HTTP_POST_VARS['status']) : intval($HTTP_GET_VARS['status']);
$sql = "UPDATE adr_classes
SET status = $status_switch
WHERE cid = '$class_id'";
if( !($result = $db->sql_query($sql)) ){
message_die(GENERAL_ERROR, "Couldn't update classes info", "", __LINE__, __FILE__, $sql);}
header('refresh: 0; url=/admin/admin_classes.php'); # redirects to our homepage
The use of header() fails because the page is already outputting html before the condition is met in the script. Usual output error.
Is there an easy way I'm missing that can refresh the page?
Thank you in advance.