473,769 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[PHP 5 XP IE6]header("test"); does not display

Hi,
I'm trying a simple form.html that call a .html script that begins
with:

<?php
header("This is a test");
?>

When I click on the link, I get blank page.

I tried every combination of .html and .php as extensions, none works.

I checked the >Tools>Config>a dvanced menus in IE6, I can't find where
could be some filter to prevent the headers from displaying.

*************** *************** *************** *************** *
I say without reservation, we ain't getting no hi-higher
It's a girl Mrs Walker it's a girl
*************** *************** *************** *************** *

Mar 23 '06 #1
10 2452

universalbitmap per wrote:
Hi,
I'm trying a simple form.html that call a .html script that begins
with:

<?php
header("This is a test");
?>

When I click on the link, I get blank page.

I tried every combination of .html and .php as extensions, none works.

I checked the >Tools>Config>a dvanced menus in IE6, I can't find where
could be some filter to prevent the headers from displaying.

*************** *************** *************** *************** *
I say without reservation, we ain't getting no hi-higher
It's a girl Mrs Walker it's a girl
*************** *************** *************** *************** *


What are you trying to do? Just make it output "This is a test" ?

If you want the file to be parsed as php, give it a .php extension. If
you want the page to display "This is a test" then it should just be
this:

<?php
echo "This is a test.";
?>

Mar 23 '06 #2
universalbitmap per wrote:
Hi,
I'm trying a simple form.html that call a .html script that begins
with:

<?php
header("This is a test");
?>

When I click on the link, I get blank page.

I tried every combination of .html and .php as extensions, none works.

Hmm.... To elaborate on the other reply slightly, header("Test"); will
output "Test" into the http headers. The headers are the bit that tell
the browser that it's about to receive a file or a web page etc and is
to all intents and purposes, invisisible to the end user. As a rough
rule, you wont need to use the header() function until you're fairly
advanced with PHP, with possibly the exception of header("Locatio n:
anotherpage.htm "); that which redirects the browser to anotherpage.
If you want to display text to the user (browser) then use echo "Test";

Good luck.

Mar 23 '06 #3
universalbitmap per wrote:
Hi,
I'm trying a simple form.html that call a .html script that begins
with:

<?php
header("This is a test");
?>

When I click on the link, I get blank page.

I tried every combination of .html and .php as extensions, none works.

I checked the >Tools>Config>a dvanced menus in IE6, I can't find where
could be some filter to prevent the headers from displaying.

*************** *************** *************** *************** *
I say without reservation, we ain't getting no hi-higher
It's a girl Mrs Walker it's a girl
*************** *************** *************** *************** *

Two things:

1. 'a simple form.html that call a .html script'.
Shouldn't that be a .php script?

2. 'header("This is a test");'
Try echo "This is a test";

-david-

Mar 23 '06 #4
Treefrog wrote:

As a rough
rule, you wont need to use the header() function until you're fairly
advanced with PHP, with possibly the exception of header("Locatio n:
anotherpage.htm "); that which redirects the browser to anotherpage.


When you use the location header, it should be a full URL, not a
relative URI. Also, you should follow the location header with a call to
exit (or die).

header('Locatio n: http://example.com/anotherpage.htm l');
exit;

--
Justin Koivisto, ZCE - ju****@koivi.co m
http://koivi.com
Mar 23 '06 #5
universalbitmap per wrote:
Hi,
I'm trying a simple form.html that call a .html script that begins
with:

<?php
header("This is a test");
?>

When I click on the link, I get blank page.

I tried every combination of .html and .php as extensions, none works.

I checked the >Tools>Config>a dvanced menus in IE6, I can't find where
could be some filter to prevent the headers from displaying.

*************** *************** *************** *************** *
I say without reservation, we ain't getting no hi-higher
It's a girl Mrs Walker it's a girl
*************** *************** *************** *************** *


form.html can be normal HTML code as you would normally do. for the form
action, set it to a php file:

<form action="somethi ng.php" ...

If you use the post method, in something.php try this:

<?php
echo '<pre>';
print_r($_POST) ;
echo'</pre>';
?>

If you use the get method, change "_POST" to "_GET". All that does is
display the array structure of the submitted information. It should give
you some insight on how you will need to handle the data.

HTH

--
Justin Koivisto, ZCE - ju****@koivi.co m
http://koivi.com
Mar 23 '06 #6
OK I see it's looking more complicated than it really is.
I just typed a 100 lines script from a manual: PHP MySQL Apache Web
Development.
Now, near the end there are these two lines:

$url = "location: showimage.php?i d=" . $lastpicid;
header( $url );

Now at runtime I get the horrible:

"Header already sent" error

As you can see, it's the header() function I'm interested in, I thought
that if I went one step at a time, I'd find out why I get this error.
That's why I tried the little script in the original post, making sure
that the call to "header()" would be the first in the php script.
I haven't got the first clue why it's possible to use "header( $url );"
near the end of a script when the specs say it should be first.
But ok, I'll do my homework and look for typos, if I get somewhere I'll
keep you posted.
(But at the end of the day I'm disappointed that "header("th is is a
test");" doesn't do anything. :-) )

Many thanks for your replies.

There only one thing more stubborn than a stubborn bug
It's a stubborn debugger ( circa Compuserve )

Mar 23 '06 #7
universalbitmap per wrote:
OK I see it's looking more complicated than it really is.
I just typed a 100 lines script from a manual: PHP MySQL Apache Web
Development.
Now, near the end there are these two lines:

$url = "location: showimage.php?i d=" . $lastpicid;
header( $url );

Header() MUST be called before any output. have a single space before
the opening <? tag will break it. This is because the headers have to
be sent before the "meat" of the page. If there's a space, PHP thinks
you've done with the headers and want to start printing out a web page.
Check for spaces, html, anything before your first <? (or <?php) tag.

Also, I just can't resist correcting you for this, but your variable
name is wrong. $url isn't a url, you've included "Location:" in it. I
hate to be picky, but it will help to be strict when you start writing
BIG programs... Oh, casing your vars properly will help to, it's
subject to preference but I like camel case (each new "word" starts
with a capital). Erm, private cars also start with lower case, and
public with upper.

Try something like

$url = 'showimage.php? id'.$lastPicId;
header("Locatio n: ".$url);
Good luck and enjoy yourself.

Mar 23 '06 #8
I didn't write this script, it comes from a manual.

That manual does not explain what particular job it uses header() in
this case for.

It's supposed to allow the user to load an image dynamically, then
display it.

It's very difficult to debug because there are 3 php pages involved and
inserting then querying from MySQL.

The bug could come from any place, like a space in the results from the
query.

But that's ok, I'll wake up some night a 3:27 and I'll shout "Eureka!"

Many thanks for your replies

*************** *************** **********
But a cheesy little amp
With a sign on the front
Said Fender Champ
- Frankie "What would you do?" Zappa
*************** *************** **********

Mar 24 '06 #9
Message-ID: <11************ **********@v46g 2000cwv.googleg roups.com> from
universalbitmap per contained the following:

The bug could come from any place, like a space in the results from the
query.


No it couldn't come from any place. PHP runs on the server, you can
have as much code as you like before header(), it's only generating
output if you either print or echo.

It is output you are looking for. Does your '<?php ' start right at the
top? A simple blank line (outside your php code) would cause output to
start.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Mar 24 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
13086
by: Gregory | last post by:
Hello, I'm trying to do the above in order to process an image and return the result to an html image control. It fails and my key suspects are either the variable that I'm passing in - ImageName - for processing, or the return data which is done (or not as the case may be) by imagejpeg($img) in the script, after header("Content-type: image/jpeg"). Any insights would be most welcome, especially debugging techniques and a pointer to...
7
4014
by: Kornelius Finkenbein | last post by:
Hello folks! I've got a strange problem with my download-script in conjunction with M$ internet explorer, if the filename I want to link to includes more than one points. In Netscape the problem doesn't exist. For example: input: ... download.php?name=virtualdub_1.4.9.zip
5
4242
by: Phil Powell | last post by:
I created a page that will be doing image resizing and manipulation, which seems to work (using GD library). However, upon returning to the page where the image has been changed, I still see the old image, until I refresh my browser and then zappo, there it is! All changed! I have done everything I can think of to force caching including this: // Date in the past header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
16
2916
by: a | last post by:
Hi everybody, My config: Win XP (or 2003), Apache 2.0.54, PHP 5.1.2. I have been trying to handle the case of a lenghty opearation on the server while providing the user with feedback and ability to cancel, and nothing seems to work so far. The following code is one attempt to address this, and it is called as result of a POST:
21
21346
by: cman | last post by:
does anyone know why i can't generate images with: header("Content-type:image/jpeg"); imagejpeg($img_number); i've tried different examples but i always get a text output as if the header doesn't make a difference at all. <?php //random_number.php $img_number = imagecreate(100,50);
6
3691
by: windandwaves | last post by:
Hi Folk Some of my clients asked me to create "fancy emails" for them (aka html formatted emails). I know how to make a nice html document, but I had trouble creating a simple way to provide the document to my clients so that they could use it to. I know most of them use Outlook XP or Outlook 2003, so what I created was a page that creates a Visual Basic script that, when saved to the desktop and
1
6509
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
5
3289
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is _uploadedfiles_xxxx) (php must be allowed to move uploaded files to this folder' - uploadedfiles_xxxx. I typed <?php chmod ('_uploadedfiles_xxxx',640); ?> into notepad and saved it as php in the uploaded_xxxx folder, when I went to test it, the error...
18
10267
Ciary
by: Ciary | last post by:
good morning/afternoon/evening/night fellow coders, like a few times before i'm stuck with a problem. this time it hes everything to do with webservices or WCF. in the end, i want to convert an xml/access/SQL database (depends on what the user uploads) to a simple multi-dimentional array. but it isn't what i was trying to do now since i'm rather new to WCF. so, i started with a simple 'hello world' coding the webservice wasn't difficult,...
0
9423
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
10211
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
10045
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...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
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...
0
6673
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();...
1
3958
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.