473,800 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using this IF to forward to page?

How can I open a page based on this IF:

Code:

if ($selected_radi o = = '0') {
WHAT NEEDS TO GO HERE IF I WANT TO OPEN http://localhost/index3.php
}

thanks
Nov 20 '07 #1
6 1550
pa*****@excite. com:
How can I open a page
To *redirect*, header("Locatio n: 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_radi o = = '0') {
WHAT NEEDS TO GO HERE IF I WANT TO OPEN http://localhost/index3.php
}
if($selected_ra dio == 0){
header('Locatio n: 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...@attgl obal.net
=============== ===
OK I understand....s o 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_ra dio == 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...@attgl obal.net
=============== ===

OK I understand....s o 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_ra dio == 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_ra dio == 0){
header('Locatio n: 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_ra dio == 0){
header('Locatio n:
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_radi o' variable? (Hint:
register_global s 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.comwro te:
>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_ra dio == 0){
header('Locatio n:
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_radi o' variable? (Hint:
register_globa ls 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_ra dio == 0){
header('Locatio n:
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_ra dio == 0 && $lstdepartment= ='lsteditorial' ){
header(......../write-editorial.php);
exit;
}
or if $selected_radio ==0 and lstdepartment == lstpress then goto page
write-press.php
if($selected_ra dio == 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
4446
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 problem with defining my JDBC resource within Tomcat. I am pretty sure that my code is correct (but I am not certain), and the problem is with defining the resource in Tomcat. Has anyone done this before? Any advice would be helpful.
14
2153
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 different height than was set in the code. However, when I use the navigation buttons in IE to go back and then forward again to the second page, the table is displayed as expected.
3
2029
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 & ";" objConnect = new OleDbConnection(strConnect) ============================= but I get the following error: <b>* Error while updating original data</b>.<br
8
6527
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 "Forward "How can I implement the back and forward procedure to make them work ? Is there anyone has the same experience like that ? Thanks
8
2855
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 :) >. I've read quite a few posts on how to do this, but none meet my need (the two main suggestions was set a jsEnabled variable in a <scriptsection of the HTML and read it in PHP, and the other suggestion was by default loading the non js page,...
1
2646
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 redirects me to another page in my site. What I would like to do is change what page directs it to. Currently the submit button redirects me to page /measure/men_measure. I would like to be able to change this. Please see below my page below:...
0
1959
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 of string manipulation where they seek through the string back and forth doing replacements to substitute in the needed HTML code. I am convinced that this can be done with a few regular expressions. Unfortunately my knowledge of regular...
1
14061
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. following are entries in struts-config.xml file <action input="index.jsp" name="loginform" path="/login" scope="session" type="com.myapp.struts.loginaction"> <forward name="success" path="/main.jsp"/>
1
7547
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 import='java.io.*,java.util.*,java.sql.*,javax.servlet.*,javax.servlet.http.*' session='true'%> <%@ page import='java.text.*'%> <html> <script language='javascript'> function backward() { alert("hello"); }
3
3562
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 this line code indentify that exist else page that visited via this page but i want to findout this pages is previous page or nextpage? thanks very much for your help
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10035
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7580
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6813
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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 we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.