473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Does a blank space sent to the browser before header statement get ignored?

hi

I write a simple script for test header statement.I expect my script show a warning message and dont transmit to another page but unfortunately, i am transmited to another page.
my question is this, is there any setting in php.ini that is related with blank space that is sent to the browser before header statement .
my experimental script is as follow as:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. ini_set("error_reporting", E_ALL);
  3. ini_set("display_errors", "on");
  4. ?>
  5.  <?php
  6. $a = 'ali';
  7.  
  8.      if($a == 'ali') {
  9.          header("Location: index2.php");
  10.      }
  11. ?>
  12. <h1>you dont transmit to another page</h1>
  13.  
thanks alot for your help.
Feb 10 '11 #1
3 1958
HaLo2FrEeEk
404 256MB
You haven't echoed anything in your script before you call the header() function.

Also:

Expand|Select|Wrap|Line Numbers
  1. <?php  
  2. ini_set("error_reporting", E_ALL); 
  3. ini_set("display_errors", "on"); 
  4. ?> 
  5.  <?php
No need to end the code block then start it again immediately after, remove the end of the first one and the start of the second one.

Basically, you haven't output anything, so your script is working as it should. This would fail (most times):

Expand|Select|Wrap|Line Numbers
  1. <?php  
  2. ini_set("error_reporting", E_ALL); 
  3. ini_set("display_errors", "on"); 
  4. $a = 'ali'; 
  5. echo $a;
  6. if($a == 'ali') { 
  7.   header("Location: index2.php"); 
  8.   } 
  9. ?>
There are certain setups on which this would still work.
Feb 10 '11 #2
hi

i close php tag and open it again deliberately because i expect to get a warning or notice for a space between closing and opening tag that is sent to browser and i dont must transmit to next page.
thanks alot
Feb 10 '11 #3
HaLo2FrEeEk
404 256MB
If you don't want to redirect then remove the redirect code.
Feb 10 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Buz | last post by:
I am having a problem with extra, unwanted space showing up on my web form tables. I've tried hand coding and can get the htm file to display fine. But as soon as I bring the form into Visual...
2
by: barb28 | last post by:
Hello, sometimes I have noticed that in web addresses, the number: 20% will show up in the address. I think this is somehow related to a 'blank space', but am unsure, does anyone know about...
0
by: Penguin | last post by:
Using Access 97, I've created a grading sheet. To save space, the subjects are in vertical columns on a sub-report, like so: Math Spelling Reading N C T A A E U A I ...
2
by: Amir | last post by:
I really hope someone can explain this behavior. I have spend quite a bit of time and tried a bunch of things, so far nothing has worked. I have a page on which I have a datagrid with template...
2
by: Bill Nguyen | last post by:
I tried in vain to add blank space to the end of couple variables as below: mPadding = Convert.ToChar(" ") mdriverBegin.PadRight(16, mPadding) mdriverEnd.PadRight(16, mPadding) ...
2
by: samyuktha takkellapati | last post by:
create or replace trigger emp_trigger after update or delete on employee for each row begin if updating then insert into empupdate(empno,ename,job,mgr,sysdate,sal,comm,deptno)...
1
by: monica4rdecos | last post by:
Hi, I am developing a website. Its width is fixed and is 1000px. I want to avoid horizontal scroll bar in a standard 1024 X 768 browser. So i fixed it as 1024px width. But in firefox a blank...
2
by: voroojak | last post by:
HI i have a proble with the blank space. i have a column for phonenumber. in phone number table each entry may have a different format. i mean one entry can be like this 228 566 59878 and the...
0
by: Tessy Mithu | last post by:
Am trying to print a receipt from VB6.0 with MS.Access as db. While generating the data report iam getting blank spaces between detailed section and Bottom margin of the report. Required to know is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.