using this IF to forward to page?
am 20.11.2007 20:41:49 von paul814How can I open a page based on this IF:
Code:
if ($selected_radio = = '0') {
WHAT NEEDS TO GO HERE IF I WANT TO OPEN http://localhost/index3.php
}
thanks
How can I open a page based on this IF:
Code:
if ($selected_radio = = '0') {
WHAT NEEDS TO GO HERE IF I WANT TO OPEN http://localhost/index3.php
}
thanks
paul814@excite.com:
> How can I open a page
To *redirect*, header("Location: http://host.invalid/").
http://www.php.net/manual/en/function.header.php
--
Jock
On Tue, 20 Nov 2007 20:41:49 +0100,
> How can I open a page based on this IF:
>
> Code:
>
> if ($selected_radio =3D =3D '0') {
> WHAT NEEDS TO GO HERE IF I WANT TO OPEN http://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:
paul814@excite.com wrote:
> On Nov 20, 3:03 pm, "Rik Wasmus"
>> On Tue, 20 Nov 2007 20:41:49 +0100,
>>> 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:
>
>
>
>
>
>
> index of selected radio button is:
>
>
> $selected_radio = $_POST['radReadWrite'];
> echo $selected_radio;
>
> if($selected_radio == 0){
> header('Location: http://localhost/production/index3.php');
> exit;
> }
> ?>
>
>
>
>
(top posting fixed)
That's because you sent output before the call to header(). You can
have no output (not even whitespace, 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.
jstucklex@attglobal.net
==================
On Nov 20, 3:32 pm, Jerry Stuckle
> paul...@excite.com wrote:
> > On Nov 20, 3:03 pm, "Rik Wasmus"
> >> On Tue, 20 Nov 2007 20:41:49 +0100,
> >>> 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:
> >
> >
> >
> >
> >
> >
> > index of selected radio button is:
> >
> >
> > $selected_radio = $_POST['radReadWrite'];
> > echo $selected_radio;
> >
> > if($selected_radio == 0){
> > header('Location:http://localhost/production/index3.php');
> > exit;
> > }
> > ?>
> >
> >
> >
> >
>
> (top posting fixed)
>
> That's because you sent output before the call to header(). You can
> have no output (not even whitespace, 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:
if($selected_radio == 0){
header('Location: http://localhost/production/index3.php');
exit;
}
$selected_radio = $_POST['radReadWrite'];
echo $selected_radio;
?>
Or should I get rid of the tags altogether?
Because the above does not work either
paul814@excite.com wrote:
> On Nov 20, 3:32 pm, Jerry Stuckle
>> paul...@excite.com wrote:
>>> On Nov 20, 3:03 pm, "Rik Wasmus"
>>>> On Tue, 20 Nov 2007 20:41:49 +0100,
>>>>> 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:
>> >
>> >
>> >
>> >
>> >
>> >
>> > index of selected radio button is:
>> >
>> >
>> > $selected_radio = $_POST['radReadWrite'];
>> > echo $selected_radio;
>> >
>> > if($selected_radio == 0){
>> > header('Location:http://localhost/production/index3.php');
>> > exit;
>> > }
>> > ?>
>> >
>> >
>> >
>> >
>>
>> (top posting fixed)
>>
>> That's because you sent output before the call to header(). You can
>> have no output (not even whitespace, 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:
>
>
> if($selected_radio == 0){
> header('Location: http://localhost/production/index3.php');
> exit;
> }
> $selected_radio = $_POST['radReadWrite'];
> echo $selected_radio;
> ?>
>
>
> Or should I get rid of the 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 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 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
==================
>
> A call to header() must be made before ANY output to the browser. This
> includes your 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 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.
> jstuck...@attglobal.net
> ==================
OK I understand....so I can have my php code first and it does not
have to be wrapped in HTML tags, OK I thought it had to be wrapped in
html tags.
What if I wanted to make the IF multi-dimensional, is it done the
same way? say I want to say something like...
if($selected_radio == 0) AND if a specific option group item is
selected, then goto this specific page...
$selected_radio is for radio buttons, what is the syntax for option
group box lists, like a list where you can drop down and pick your
State from a list of 50.
On Nov 20, 4:07 pm, paul...@excite.com wrote:
> > A call to header() must be made before ANY output to the browser. This
> > includes your 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 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.
> > jstuck...@attglobal.net
> > ==================
>
> OK I understand....so I can have my php code first and it does not
> have to be wrapped in HTML tags, OK I thought it had to be wrapped in
> html tags.
>
> What if I wanted to make the IF multi-dimensional, is it done the
> same way? say I want to say something like...
> if($selected_radio == 0) AND if a specific option group item is
> selected, then goto this specific page...
> $selected_radio is for radio buttons, what is the syntax for option
> group box lists, like a list where you can drop down and pick your
> State from a list of 50.
OK well the page write-editorial.php opens now but it opens if radio
selected = 0 or 1. it should only do it if == 0. Am I missing
something?
if($selected_radio == 0){
header('Location: http://localhost/production/write-editorial.php');
exit;
}
?>
do I first have to tell it what radio button is called, ex:
radReadWrite ?
On Tue, 20 Nov 2007 22:32:45 +0100,
> OK well the page write-editorial.php opens now but it opens if radio
> selected =3D 0 or 1. it should only do it if == 0. Am I missing
> something?
>
>
> if($selected_radio == 0){
> header('Location: =
> http://localhost/production/write-editorial.php');
> exit;
> }
> ?>
>
> do I first have to tell it what radio button is called, ex:
> radReadWrite ?
Well, how do you get this magic '$selected_radio' variable? (Hint: =
register_globals is probably off, so $selected_radio is not set. Loose =
comparison of 0 against NULL equals true)
-- =
Rik Wasmus
On Nov 20, 7:21 pm, "Rik Wasmus"
height="30" /> What would you like
> On Tue, 20 Nov 2007 22:32:45 +0100,
> > OK well the page write-editorial.php opens now but it opens if radio
> > selected = 0 or 1. it should only do it if == 0. Am I missing
> > something?
>
> >
> > if($selected_radio == 0){
> > header('Location:
> >http://localhost/production/write-editorial.php');
> > exit;
> > }
> > ?>
>
> > do I first have to tell it what radio button is called, ex:
> > radReadWrite ?
>
> Well, how do you get this magic '$selected_radio' variable? (Hint:
> register_globals is probably off, so $selected_radio is not set. Loose
> comparison of 0 against NULL equals true)
> --
> Rik Wasmus
OK I see what I was doing wrong again, I was not assigning a value to
the variable first.
.........
Right now I have a simple IF to take me to a page based on selected
radio button:
Code:
$selected_radio = $_POST['radReadWrite'];
if($selected_radio == 0){
header('Location: http://localhost/production/write-editorial.php');
exit;
}
?>
How would I make this multi-dimensional, meaning I also have a option
group pull down, like a pull down you would see on the web for
selecting your State.
I want to do something like this:
If $selected_radio ==0 and lstdepartment == lsteditorial then goto
page write-editorial.php
or if $selected_radio ==0 and lstdepartment == lstpress then goto page
write-press.php
something like that?
How do I get the value of my lstbox? like I did for radio...
$selected_radio = $_POST['radReadWrite'];
Here is my code with the actual radio buttons and lst boxes:
Code:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
to do?:
Thanks for any help..
On Wed, 21 Nov 2007 17:26:29 +0100,
> On Nov 20, 7:21 pm, "Rik Wasmus"
>> On Tue, 20 Nov 2007 22:32:45 +0100,
>> > OK well the page write-editorial.php opens now but it opens if radi=
o
>> > selected =3D 0 or 1. it should only do it if == 0. Am I missi=
ng
>> > something?
>>
>> >
>> > if($selected_radio == 0){
>> > header('Location:
>> >http://localhost/production/write-editorial.php');
>> > exit;
>> > }
>> > ?>
>>
>> > do I first have to tell it what radio button is called, ex:
>> > radReadWrite ?
>>
>> Well, how do you get this magic '$selected_radio' variable? (Hint:
>> register_globals is probably off, so $selected_radio is not set. Loos=
e
>> comparison of 0 against NULL equals true)
>
> OK I see what I was doing wrong again, I was not assigning a value to
> the variable first.
> ........
> Right now I have a simple IF to take me to a page based on selected
> radio button:
>
> Code:
>
> $selected_radio =3D $_POST['radReadWrite'];
> if($selected_radio == 0){
> header('Location: =
> http://localhost/production/write-editorial.php');
> exit;
> }
> ?>
>
> How would I make this multi-dimensional, meaning I also have a option
> group pull down, like a pull down you would see on the web for
> selecting your State.
>
> I want to do something like this:
> If $selected_radio ==0 and lstdepartment == lsteditorial then =
goto
> page write-editorial.php
if($selected_radio == 0 && $lstdepartment=='lsteditorial'){
header(......../write-editorial.php);
exit;
}
> or if $selected_radio ==0 and lstdepartment == lstpress then g=
oto page
> write-press.php
if($selected_radio == 0 && $lstdepartment=='lstpress'){
header(......../write-press.php);
exit;
}
> something like that?
> How do I get the value of my lstbox? like I did for radio...
> $selected_radio =3D $_POST['radReadWrite'];
Indeed, just use the right name from your form ($_POST['lstdepartment'])=
-- =
Rik Wasmus