Jump to content

[SOLVED] header() function alternative ????


plodos

Recommended Posts

<table>
<tr>
<td align='left' width='100%' height='15'>

<?php if(isset($_GET['wrong_code17'])){ ?> 

<div style='border:1px solid #990000; background-color:#D70000; 
color:#FFFFFF; padding:4px; padding-left:6px; width:300px;'>
There is no paper to review.
<?php } ?>

</td>
</tr>
</table>
    
<?php
$opstr=array();

if(!count($opstr))
{
header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
}
else
{
$opstr=implode('<br />', $opstr);
}
echo $opstr;	
?>

 

1) if $opstr is empty

2) run the header() function!

3) refresh the page with activate the wrong_code17

 

but it is not working,  because HTML codes are installing before the header() 

 

I used used ob_start(); ob_end_flush(); for "Warning: Cannot modify header information" but still the page is not show anything

 

what is the alternative of header()

if(!count($opstr))
{
//header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
        refresh the page with activate the wrong_code17
}

how can I refresh the page with activate the wrong_code17

Help me please :(

 

Link to comment
https://forums.phpfreaks.com/topic/137475-solved-header-function-alternative/
Share on other sites

PHPDocument3.php

<?php 
ob_start('wrong_code17');
// also I used ob_start();
?>
<table>
<tr>
<td align='left' width='100%' height='15'>

<?php if(isset($_GET['wrong_code17'])){ ?> 

<div style='border:1px solid #990000; background-color:#D70000; 
color:#FFFFFF; padding:4px; padding-left:6px; width:300px;'>
There is no paper to review.
<?php } ?>

</td>
</tr>
</table>
    
<?php
$opstr=array();

if(!count($opstr))
{
header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
}
else
{
$opstr=implode('<br />', $opstr);
}
echo $opstr;	
?>
<?php ob_end_flush(); ?>

 

when I click the http://www.aaaa.com/PHPDocument3.php page is trying to refresh

 

after refresh, link is changing http://aaaa.com/PHPDocument3.php?wrong_code17=true

and its show nothing...

 

 

what can be the problem...

im using another codes before the header() thats the big problem but i dont how can i organize the codes

if(!count($opstr))
{
   //header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
        refresh the page with activate the wrong_code17
}

are there alternative ways to refresh the page and activate with wrong_code17

 

if the variable is empty, show the error part, i need that:(

 

 

<?php
$opstr=array();

if (!count($opstr)) {
  header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
} else {
?>
<table>
<tr>
<td align='left' width='100%' height='15'>
<?php
  if (isset($_GET['wrong_code17'])){ ?> 
    <div style='border:1px solid #990000; background-color:#D70000; 
    color:#FFFFFF; padding:4px; padding-left:6px; width:300px;'> 
    There is no paper to review.
<?php
  }
  $opstr=implode('<br />', $opstr);
  echo $opstr;
}	
?>
</td>
</tr>
</table>

 

ps: The $opstr array is always going to be empty according to your logic.

you are right "thorpe"

 

i listened to you, and I changed  something

 

if(!count($opstr)){
//header("Location:".$_SERVER["PHP_SELF"]."?wrong_code17=true");
$opstr ="<table>
<tr>
<td align='left' width='100%' height='15'>

<div style='border:1px solid #990000; background-color:#D70000; 
color:#FFFFFF; padding:4px; padding-left:6px; width:300px;'>
There is no paper to review.

</td>
</tr>
</table>";
}else{
$opstr=implode('<br />', $opstr);
}
echo $opstr;

 

it is doing the same job.

 

thanks for everything :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.