473,378 Members | 1,333 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,378 software developers and data experts.

Executing another PHP page

25
Hi,
I have a section of code, whereby after satisfying certain conditions of variables,
I would like PHP to leave it's current page, and launch a different PHP page.

Sort of like if a user had clicked on a Link or a submit button.

thank you.
Sep 6 '06 #1
6 1701
ronverdonk
4,258 Expert 4TB
As in:

[PHP]
if (condition == 'met')
header('Location: new_page.php');
else {
// do whatever you need to do here
}
[/PHP]

Ronald :cool:
Sep 6 '06 #2
adriann
25
Hi Ronald,

I tried yr code suggestion but I got the old "headers already sent " error message.

Warning: Cannot modify header information - headers already sent by... blah blah blah.

Are there any other ways to perform this task?

thank you.
Sep 7 '06 #3
phpmaet
27
Hi,

This is another way for skip the current page.

[PHP]if($_POST($cond))
{
echo '<meta http-equiv=refresh content=0;url=home.php>';
}[/PHP]
Sep 7 '06 #4
Banfa
9,065 Expert Mod 8TB
or alternitively

[php]
if (condition == 'met')
require_once('new_page.php');
else {
// do whatever you need to do here
}

[/php]
Sep 7 '06 #5
For uses

header('Location: new_page.php');

You can uses ob_start(); and ob_end_flush();

Example::

<?
ob_start();

.....
.....
if ($condition1)
{
header('Location: new_page1.php');
}
.....
.....
.....
if ($condition1)
{
header('Location: new_page1.php');
}

ob_end_flush();

?>


=====================

Hi Ronald,

I tried yr code suggestion but I got the old "headers already sent " error message.

Warning: Cannot modify header information - headers already sent by... blah blah blah.

Are there any other ways to perform this task?

thank you.
Sep 25 '06 #6
skim
9
using JS. This is the easiest way.

<?php
whatever your code...
if( whatever condition){
?>
<SCRIPT LANGUAGE ="JavaScript">
window.location = "./your/file.php"
</SCRIPT>
<?php
}

Whatever yourcode....
?>
Done.
Sep 26 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Brian Burgess | last post by:
Hi all, Anyone know of any special issues with Server.Execute? Specifically for me it simply is not executing ... the server does not transfer to the page specified. The calling ASP just...
1
by: acharyaks | last post by:
Hi Guru, the aspx page code executing behind the controls and functions executing twice. How can I avoid running the code behind the controls (for example this vanishes the control box text...
3
by: Daniel Groh | last post by:
Hi, I've written a C# Server.Transfer from WebForm1.aspx to WebForm2.aspx In both i'm using the same user control but with different params, for example; In the user control: ...
4
by: Peter Strøiman | last post by:
Hi. I have an ASP page that will receive a lot of post data ( sometimes many MB! ). The ASP page processes the data sequentially, but does not need the entire data stored in memory. ...
7
by: Jibey | last post by:
Hello: I'm facing a very strange problem. When I run my Web application in Visual Studio.NET the Page_Load event is not executing. Other events like a Button_Click are executing. It doesn't...
2
by: Stefan | last post by:
Hello, for the implementation of a http module I have to get to the currently executing page handler (to query some specific page properties via reflection). I was looking at ...
1
by: Al-Pacino | last post by:
Hello All, I am am having a strange problem. I am trying to execute a DTS package from VB .NET (.aspx) page. The DTS package takes 21 minutes to execute. When the aspx page sends a command to...
7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
2
by: =?Utf-8?B?Um9nZXIgTWFydGlu?= | last post by:
I am executing an AJAX page method that is a long running task. After starting the first method, I execute a second page method to retrieve the status of the task. It works fine in an empty web...
0
Frinavale
by: Frinavale | last post by:
I have a peculiar problem... Background: I have a function that I don't want the user to execute more than once while they are waiting for it to process; therefore, I disable all of the...
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...
0
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...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.