Reply to Re: using this IF to forward to page?

Your name:

Reply:


Posted by Jerry Stuckle on 11/20/07 20:56

paul814@excite.com wrote:
> On Nov 20, 3:32 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> paul...@excite.com wrote:
>>> On Nov 20, 3:03 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>>>> On Tue, 20 Nov 2007 20:41:49 +0100, <paul...@excite.com> wrote:
>>>>> How can I open a page based on this IF:
>>>>> Code:
>>>>> if ($selected_radio = = '0') {
>>>>> WHAT NEEDS TO GO HERE IF I WANT TO OPENhttp://localhost/index3.php
>>>>> }
>>>> if($selected_radio == 0){
>>>> header('Location:http://localhost/index3.php');
>>>> exit;}
>>>> --
>>>> Rik Wasmus
>> > this is what I get:
>> > index of selected radio button is: 0
>> > Warning: Cannot modify header information - headers already sent by
>> > (output started at C:\xampp\htdocs\production\select.php:10) in C:
>> > \xampp\htdocs\production\select.php on line 15
>> >
>> > with this code:
>> > <html xmlns="http://www.w3.org/1999/xhtml">
>> > <head>
>> > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
>> > <title> Production Report</title>
>> > </head>
>> > <body>
>> > index of selected radio button is:
>> >
>> > <?PHP
>> > $selected_radio = $_POST['radReadWrite'];
>> > echo $selected_radio;
>> >
>> > if($selected_radio == 0){
>> > header('Location:http://localhost/production/index3.php');
>> > exit;
>> > }
>> > ?>
>> > </body>
>> > </html>
>> >
>> >
>>
>> (top posting fixed)
>>
>> That's because you sent output before the call to header(). You can
>> have no output (not even whitespace, <html> tag, etc.) before a call to
>> header().
>>
>> P.S. Please don't top post.
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> I dont understand....
> so should my select.php just be:
> <html>
> <?PHP
> if($selected_radio == 0){
> header('Location: http://localhost/production/index3.php');
> exit;
> }
> $selected_radio = $_POST['radReadWrite'];
> echo $selected_radio;
> ?>
> </html>
>
> Or should I get rid of the <html> </html> tags altogether?
> Because the above does not work either
>

A call to header() must be made before ANY output to the browser. This
includes your <html> tag, any white space - anything.

As soon as you send even one byte - no matter what's in that byte - to
the browser, the web server sends the headers. It is now too late for
your header() call.

You can keep the <html> tag - but it must be *after* your PHP code which
calls header().

And thanks for not top posting :-)

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация