473,757 Members | 9,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

64 New Member
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 1985
HaLo2FrEeEk
404 Contributor
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
sedigh mohseni
64 New Member
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 Contributor
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
411
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 Studio, convert it to an aspx web form, and insert my user controls, I start getting extra blank space between my rows, even when I give an explicit "height" attribute. The problem seems to occur with tables that have rowspans and/or user...
2
37144
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 this? I have seen it mostly I think with netscape,
0
2291
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 C C X M L M C C P B C E U U R E U S R R E
2
2230
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 columns. I perform regular expression validations in the EditItemTemplate for the fields that require such validation. The datagrid is inside a div tag to make it scrollable. I have implemented the solution to freeze header for this grid - the...
2
8273
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) mSitekey.PadRight(4, mPadding)
2
18910
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) values(:old.empno,:old.ename,:old.job,:old.mgr,:old.hiredate,:old.sal,:old.comm,:old.deptno); elsif deleting then insert into empdelete(empno,ename,job,mgr,sysdate,sal,comm,deptno)...
1
2753
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 space is displayed on the right side of the site and as a result a horizontal scroll bar is coming. I have given width of the body as 1000px and i am using a table inside body whose width is 100% and i made sure that contents inside table would not...
2
1952
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 other one can be 457748 6958 or 258 265897. what i wantto do is that i want all the number stick together and be like this 256987412557. i know that with ltrim or rtim i can remove teh space from the begining or end. thanks alot
0
1749
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 there any possibilities which i can remove these blank space by coding. Following codes are used for printing report. With DO_Receipt.Sections(1).Controls .Item("Lbl_Date").Caption = Frm_Counter.Lbl_RcptDate.Caption ...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.