Hiya, just need help with PHP headers.
I have an index php page which has the following code within a header
redirect:
<?php
if ( empty($_GET['month']) )
if (empty($_GET['year']) )
{
$month = date(n);
$year = date(Y);
header("Location: index.php?month=$month&year=$year");
}
?>
On the same index.php page, I have a shoutbox (include file) which inputs
the content of the shoutbox form into a database. After the user fills out
the form, I want the index page to refresh again because if I leave it as it
is and a user inputs info into the form, if they press refresh, the form
resubmits thus recording two entries into the shoutbox, or however many
times refresh is pressed.
When I add a header redirect into the shoutbox include file, once the user
clicks on send, index.php throws a headers cannot be sent error message.
Can anyone help?
Cheers. 11 2279
DaRemedy wrote: Hiya, just need help with PHP headers.
Multi-posting to at least three different news groups, it looks like you
need some help posting to usenet properly to...
If you want to post to more than 1 newsgroup, use the Newsgroups: field to
compose a comma-seperated list of target news groups. This procedure is
called "Cross-posting" and prevents individual threads on the same topic.
See the headers of this reply.
When I add a header redirect into the shoutbox include file, once the user clicks on send, index.php throws a headers cannot be sent error message.
To quote the manual page at http://www.php.net/header:
"Remember that header() must be called before any
actual output is sent, either by normal HTML
tags, blank lines in a file, or from PHP. It is a
very common error to read code with include(), or
require(), functions, or another file access function,
and have spaces or empty lines that are output before
header() is called. The same problem exists when using
a single PHP/HTML file."
JW
I do apologise for cross posting.
"Janwillem Borleffs" <jw@jwscripts.com> wrote in message
news:41***********************@news.euronet.nl... DaRemedy wrote: Hiya, just need help with PHP headers.
Multi-posting to at least three different news groups, it looks like you need some help posting to usenet properly to...
If you want to post to more than 1 newsgroup, use the Newsgroups: field to compose a comma-seperated list of target news groups. This procedure is called "Cross-posting" and prevents individual threads on the same topic. See the headers of this reply.
When I add a header redirect into the shoutbox include file, once the user clicks on send, index.php throws a headers cannot be sent error message.
To quote the manual page at http://www.php.net/header:
"Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file."
JW
Even if I add the headers before any html output and making sure that there
is no whitespace, the header still doesn't work, is it because the header o
the index.php page is already being called? how do I get around it?
Many thanks.
"DaRemedy" <de******@btinternet.com.nospam> wrote in message
news:cj**********@titan.btinternet.com... I do apologise for cross posting.
"Janwillem Borleffs" <jw@jwscripts.com> wrote in message news:41***********************@news.euronet.nl... DaRemedy wrote: Hiya, just need help with PHP headers.
Multi-posting to at least three different news groups, it looks like you need some help posting to usenet properly to...
If you want to post to more than 1 newsgroup, use the Newsgroups: field
to compose a comma-seperated list of target news groups. This procedure is called "Cross-posting" and prevents individual threads on the same
topic. See the headers of this reply.
When I add a header redirect into the shoutbox include file, once the user clicks on send, index.php throws a headers cannot be sent error message.
To quote the manual page at http://www.php.net/header:
"Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file."
JW
DaRemedy wrote: Even if I add the headers before any html output and making sure that there is no whitespace, the header still doesn't work, is it because the header o the index.php page is already being called? how do I get around it?
You have to be sure there aren't any whitespaces or html output on files that
are included too.
If you have more tha one header in the same file and they try to do simlare
things you will run into a conflict (think the first one is the one that will
be executed).
Cheers for that,
I managed to get it sorted using an 'if statement'. I made is so that if the
shoutbox form is sent then to go to back index.php otherwise go to
index.php?month=$month&year=$year. Telling the form to go back to index.php
would call the month and year variables anyway, using:
<?php
(if form is sent do this) {
header("Location: index.php");
} else {
if ( empty($_GET['month']) )
if (empty($_GET['year']) )
{
$month = date(n);
$year = date(Y);
header("Location: index.php?month=$month&year=$year");
}
?>
Cheers for the help guys, really do appreciate it.
"J.O. Aho" <us**@example.net> wrote in message
news:2r*************@uni-berlin.de... DaRemedy wrote: Even if I add the headers before any html output and making sure that there is no whitespace, the header still doesn't work, is it because the header o the index.php page is already being called? how do I get around it?
You have to be sure there aren't any whitespaces or html output on files that are included too.
If you have more tha one header in the same file and they try to do simlare things you will run into a conflict (think the first one is the one that will be executed).
.oO(Sippy)
One more thing: header("Location: index.php?month=$month&year=$year");
The Location-header requires an absolute address, including the scheme
( http://) and hostname.
Micha
Thanks Michael,
Is it absolutely nessecary to use an absolute address? because the code i
posted in an earlier post seems to work fine without any problems.
What I would really need to do is to change the header redirect slightly to
redirect to the same page that the shoutbox was filled in from, e.g. the
shoutbox was filled in from, lets say, the about.php page, so I would want
the shoutbox to go back to that particular page after the form is submitted.
Would I need to use $_SERVER['PHP_SELF'];
Cheers.
Sippy.
"Michael Fesser" <ne*****@gmx.net> wrote in message
news:fa********************************@4ax.com... .oO(Sippy)
One more thing:
header("Location: index.php?month=$month&year=$year");
The Location-header requires an absolute address, including the scheme (http://) and hostname.
Micha
.oO(DaRemedy) Is it absolutely nessecary to use an absolute address? because the code i posted in an earlier post seems to work fine without any problems.
It works in most browsers (doesn't necessarily mean it'll work in all),
but a full address is required by the HTTP specification (RFC 2616):
"The field value consists of a single absolute URI."
In the PHP manual there's a little example on how to add scheme and
hostname automatically to build an absolute address from a relative one
for an RFC-compliant Location-header. http://www.php.net/header
What I would really need to do is to change the header redirect slightly to redirect to the same page that the shoutbox was filled in from, e.g. the shoutbox was filled in from, lets say, the about.php page, so I would want the shoutbox to go back to that particular page after the form is submitted. Would I need to use $_SERVER['PHP_SELF'];
Yep.
Micha
Cheers matey, I really do appreciate your help.
"Michael Fesser" <ne*****@gmx.net> wrote in message
news:1n********************************@4ax.com... .oO(DaRemedy)
Is it absolutely nessecary to use an absolute address? because the code i posted in an earlier post seems to work fine without any problems.
It works in most browsers (doesn't necessarily mean it'll work in all), but a full address is required by the HTTP specification (RFC 2616):
"The field value consists of a single absolute URI."
In the PHP manual there's a little example on how to add scheme and hostname automatically to build an absolute address from a relative one for an RFC-compliant Location-header.
http://www.php.net/header
What I would really need to do is to change the header redirect slightly
toredirect to the same page that the shoutbox was filled in from, e.g. the shoutbox was filled in from, lets say, the about.php page, so I would
wantthe shoutbox to go back to that particular page after the form is
submitted.Would I need to use $_SERVER['PHP_SELF'];
Yep.
Micha
Ответьте, пожалуйста, если вам, это, не обидно, если не трудно!
Мой сервер не поддерживает CGI, ASP, PHP, SSI , но я имею скрипт PHP, который необходим для работы страницы ....
Куда ийти, что сделать, чтобы дать поддержку страницы на моём сервере? Что, ещё, рекомендуете? pe*****@rol.ru
Answer, please, if to you, it, is not insulting, if not it is difficult!
My server does not support CGI, ASP, PHP, SSI, but I have скрипт PHP, which is necessary for work of page....
Where ийти what to make to give support of page on my server? What, still, recommend? pe*****@rol.ru
While the city slept, pe******@rol.ru (pe******@rol.ru) feverishly typed... Answer, please, if to you, it, is not insulting, if not it is difficult! My server does not support CGI, ASP, PHP, SSI, but I have скрипт PHP, which is necessary for work of page.... Where ийти what to make to give support of page on my server? What, still, recommend?
If you need to use a php script for your site, but your server doesn't
support PHP, you have 2 options.
1. Persuade whoever hosts your site to install PHP for you.
2. Move to a host that does support PHP. I personally reccomend Affordable
Host ( http://www.affordablehost.com ). You can get PHP enabled hosting
there for as little as $35.95USD / Year if you don't need MySQL, or
$5.95USD/month if you do need MySQL.
Hope that helps,
Nige
--
Nigel Moss http://www.nigenet.org.uk
Mail address not valid. ni***@DOG.nigenet.org.uk, take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Thomas Kemmerich |
last post by:
hi,
i'm looking for a possibility to start a download.
here is my current code:
header("Content-Type: $_contenttype");
header("Content-Disposition: attachment;
filename=\"$_filename\"");...
|
by: Frank Thorstens |
last post by:
Hi,
i try to give my script headers so the output text would be downloaded in
the client's browser and not displayed. But it doesn't work at all in my IE
6 and Opera.
<?...
|
by: Luke Airig |
last post by:
I am using the Saxon engine and I have an xml file that contains
batches of records. Each batch starts with a header record and the
associated detail records immediately follow each header. There...
|
by: Karthik |
last post by:
When I try to compile my VC++ program (am Using VS6.0). I get the
following error in a header file ATLCONV.H.
c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(52)
: error...
|
by: Matthew Harvey |
last post by:
Hello,
I am having a problem getting a custom soap header to work with PHP5.
What I require is something like this:
<SOAP-ENV:Header>
<USER>myusername</USER>
<PASSWORD>mypassword</PASSWORD>...
|
by: Grim Reaper |
last post by:
I know this is probably an easy question, but I could not find/figure it
out.
Basically, I am printing mailing labels with a "Sorting/Grouping" section
that groups the label types together....
|
by: saleek |
last post by:
I was wondering if there is a way I can add an extra header to a datagrid?
I found this solution on the internet - but it seems quite old and didn't
work for me.
...
|
by: jszczepankiewicz |
last post by:
Witam,
mam nastepujacy problem:
XSLT 2.0,
Hi,
i've got following problem with xslt 2:
my xml doc looks something linke:
<manual>
|
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= |
last post by:
Hello misters,
I have an DAtalist that generates an html table with a header. There are
many rows, and I want that it appears scroll horizontal and vertical, and the
header be fixed.
Any help...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |