473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

using this IF to forward to page?

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
Nov 20 '07 #1
6 1532
pa*****@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
Nov 20 '07 #2
On Tue, 20 Nov 2007 20:41:49 +0100, <pa*****@excite.comwrote:
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
}
if($selected_radio == 0){
header('Location: http://localhost/index3.php');
exit;
}
--
Rik Wasmus
Nov 20 '07 #3
>
A call to header() must be made before ANY output to the browser. This
includes your <htmltag, 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 <htmltag - 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.
Nov 20 '07 #4
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 <htmltag, 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 <htmltag - 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?

<?PHP
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 ?
Nov 20 '07 #5
On Tue, 20 Nov 2007 22:32:45 +0100, <pa*****@excite.comwrote:
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?

<?PHP
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
Nov 21 '07 #6
On Wed, 21 Nov 2007 17:26:29 +0100, <pa*****@excite.comwrote:
On Nov 20, 7:21 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.comwrote:
>On Tue, 20 Nov 2007 22:32:45 +0100, <paul...@excite.comwrote:
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?
<?PHP
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)

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:
<?PHP
$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
if($selected_radio == 0 && $lstdepartment=='lsteditorial'){
header(......../write-editorial.php);
exit;
}
or if $selected_radio ==0 and lstdepartment == lstpress then goto 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 = $_POST['radReadWrite'];
Indeed, just use the right name from your form ($_POST['lstdepartment'])
--
Rik Wasmus
Nov 21 '07 #7

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

Similar topics

2
by: Jon Dellaria | last post by:
I have been using MySql as the database using JSP's and JavaBeans but recently I have wanted to start using the database connection pooling mechanism built into TomCat. I think I am having a...
14
by: Carl Gilbert | last post by:
Hi I am currently writing a site that utilises tables. I have one page that links to a second page. The only problem is that when I link to the second page, the table loads up with a...
3
by: COHENMARVIN | last post by:
I put the following code in my asp.net page: dbPath = MapPath("/FBDB/db1_newport2003.mdb") strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" strConnect = strConnect & "Data Source=" & dbpath & ";"...
8
by: Tracey | last post by:
Hi, guys. My application requires functionalities like back and forward navigating button on winforms. And there are many forms linking each other. Each form has a pair of buttons of "Back" and...
8
by: Taras_96 | last post by:
Hi everyone, We' ve come to the conclusion that we wish the user to be directed to an error page if javascript is disabled <enter comment about how a webpage shouldn't rely on javascript here :)...
1
by: ansc1 | last post by:
Hello, I'm new to using php coding. I need help with the following: 1. There is a submit button on the form and is saves information to my database. After clicking on "Save Measurement" it...
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
1
by: anupamaavadutha | last post by:
hi all, iam new to javascript. i have problem calling javascript functions.iam designing a calender page.here is my code. <%@ page...
3
oranoos3000
by: oranoos3000 | last post by:
hi i'm a beginer javascript would you please help me i d like to findout this page has next page or previous page in history object i use this line of code if(window.history.length>0) and with...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
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...
0
isladogs
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 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.