473,499 Members | 1,548 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>advanced 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 2431

universalbitmapper 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>advanced 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
universalbitmapper 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("Location:
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
universalbitmapper 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>advanced 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("Location:
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('Location: http://example.com/anotherpage.html');
exit;

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Mar 23 '06 #5
universalbitmapper 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>advanced 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="something.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.com
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?id=" . $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("this 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
universalbitmapper 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?id=" . $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("Location: ".$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**********************@v46g2000cwv.googlegroups .com> from
universalbitmapper 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
You're right, I have added a few echo-es and print_r for debug purposes
to the original listing.
I'll remove them see what happens.
The header() call happens on line 62, the only "output" is an insert
in the database.

Still I'd like to have a debug tool that follows the .php navigation.

Many thanks for your reply.
*****************************
I'm going no-where
Somebody help me there
*****************************

Mar 25 '06 #11

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

Similar topics

14
13045
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 -...
7
3993
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...
5
4226
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...
16
2892
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...
21
21235
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...
6
3662
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...
1
6435
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"...
5
3261
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...
18
10240
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...
0
7128
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6892
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...
0
7385
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...
1
4917
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...
0
4597
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...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
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 ...
0
294
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...

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.