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

To redirect if no parameters

Hi at all
I have a php page where I display mysql table datas
if the user call the page without one or more parameters I'ld want to
redirect it to another page
Therefore I wrote
if ($REQUEST_METHOD=="POST") {
$HTTP_STR=$HTTP_POST_VARS;
}else{
$HTTP_STR=$HTTP_GET_VARS;
}
while(list($chiave,$valore)=each($HTTP_STR))
{
}
if ($dbf=="")
{header("Location: http://www.pippo.es/");exit()}
But it do not work
Why please?
regards
May 19 '07 #1
2 1991
Robertu kirjoitti:
$HTTP_STR=$HTTP_POST_VARS;
$HTTP_STR=$HTTP_GET_VARS;
$HTTP_POST_VARS and $HTTP_GET_VARS are deprecated. It means do not use
these anymore. These will not be avaialable in future versions of php,
instead use $_POST and $_GET.
if ($dbf=="")
{header("Location: http://www.pippo.es/");exit()} <<--- missing semicolon ; after exit().
Try not to write everything on one line so you'll see better what is
wrong. It's easier to read.

if ($dbf=="") {
header("Location: http://www.pippo.es/");
exit();
}

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
May 19 '07 #2
At Sat, 19 May 2007 07:02:15 +0000, Robertu let his monkeys type:
Hi at all
I have a php page where I display mysql table datas
if the user call the page without one or more parameters I'ld want to
redirect it to another page
Therefore I wrote
if ($REQUEST_METHOD=="POST") {
$HTTP_STR=$HTTP_POST_VARS;
}else{
$HTTP_STR=$HTTP_GET_VARS;
}
while(list($chiave,$valore)=each($HTTP_STR))
{
}
if ($dbf=="")
{header("Location: http://www.pippo.es/");exit()}
But it do not work
Why please?
regards
In your posted code the while loop does nothing, and I wonder where $dbf
gets its value. Just a typo here or actual code?

Or have you -by chance- sent any output to the browser on this page
BEFORE sending the location header? (You should not, as it forces a header
to be sent already).

Also, $HTTP_POST_VARS, $HTTP_GET_VARS and $REQUEST_METHOD are deprecated,
use $_POST, $_GET and $_SERVER['REQUEST_METHOD'] instead.

HTH
Sh.
May 19 '07 #3

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

Similar topics

0
by: J. Miller | last post by:
I have a datagrid with update/cancel on one side, a button on the other which, when clicked, will take the user to a page that allows them to e-mail that particular observation's data. My problem,...
3
by: JohnZing | last post by:
hi, i have a question about redirect, parameters and anchors i want to do the following redirect (just an example) Response.Redirect("default.aspx?d=ev&eid=7") but i want also to add #forum...
3
by: michael_vanommeren | last post by:
I have two web applications that I am working with and I am trying to do a Response.Redirect from one to the other. They are setup as separate web applications on the same IIS server. If I go...
3
by: neil_pat | last post by:
I have a stored procedure which returns a value of between 0 and 4. I want the user to press a button to receive feed back on their last input. The save button takes the input and saves it to...
3
by: Peter Kirk | last post by:
Hi I need to write a method which accepts a url (string) and redirects to it. In addition to this I need to either (a) add a parameter to the url; or (b) add the parameter to the header of the...
3
by: alasdair.stirling | last post by:
Dear All, I am new to ASP/ASP.Net and am trying to workout the exact meaning of some old ASP Classic code. Can anyone please explain the meaning of the following line of code: ...
5
by: Nirmal Singh | last post by:
I am a newbie trying to learn ASP.net 2.0. I want to retrieve the QueryString and process it to produce some parameters. I then want to redirect the user to another page, passing these...
0
by: peanutgnome | last post by:
Folks, looking for a little guidance on an .htaccess redirect problem - I'm a bit of a newbie when it comes to the rewriting of urls... We've changed from one CMS to another on our company...
3
by: =?Utf-8?B?UGF0UA==?= | last post by:
We have a site that gets many requests for nonexistent pages, files and folders. We want those requests redirected to the index page. However, for static files (i.e. images and some other...
1
by: zizi2 | last post by:
I have a form that I want to redirect to another page after clicking the submit button. It works well (please see the code below) except that it cancells my pop-up message, it goes the redirected...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.