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
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...

Link to comment
Share on other sites

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:(

 

 

Link to comment
Share on other sites

<?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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.