Jump to content


PHP Redirecting


11 replies to this topic

#1 l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,596 posts
  • Gender:Male
  • Location:San Francisco Bay Area

Posted 04 May 2006 - 05:46 AM

Theres to problems, I need to know how to redirect to another page after they click submit and after the PHP needed has executed...and not using the header() function.

#2 liveman

    Young Padawan

  • Members
  • Pip
  • 246 posts
  • Location:New Jersey

Posted 04 May 2006 - 05:58 AM

Here, put this were you want to redirect
<html>
<HEAD>
<script language="JavaScript">
var browserVer=parseInt(navigator.appVersion); 
if (browserVer >= 4)
{
 window.location= URL HERE
}
else
{
window.location= And Here
}
//-->
</SCRIPT>
</head>
</html>


#3 l3lueMage

    Wanna Be Moderator

  • Publishing Betazoids
  • PipPipPipPip
  • 4,596 posts
  • Gender:Male
  • Location:San Francisco Bay Area

Posted 04 May 2006 - 06:22 AM

Thanks that worked :o

#4 Stu

    Retired P2L Staff

  • Publishing Betazoids
  • PipPipPipPip
  • 1,761 posts
  • Gender:Male

Posted 04 May 2006 - 06:27 AM

or if you dont want to use js you can just use meta refresh http://www.pageresou...html/metref.htm

#5 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 04 May 2006 - 07:25 AM

yh, use meta refresh instead, works with all browsers and no javascript required.

#6 DanWilliamson

    P2L Jedi

  • Members
  • PipPipPip
  • 650 posts

Posted 04 May 2006 - 07:43 AM

I always though META refresh messed up SEO though "/

#7 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 04 May 2006 - 08:10 AM

You dont want google to index a page that executes some kind of script anyway.

#8 Indigo

    Official Alien

  • Members
  • PipPipPip
  • 617 posts
  • Gender:Male
  • Location:Trondheim, Norway
  • Interests:Computing in general, especially design and programming of all kinds.

Posted 04 May 2006 - 11:01 AM

If I print a message like this:
print("Hello world!");
Should the meta-refresh be before the text (like print("meta - text"); ) or after the text (like print("text - meta); )?

#9 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 04 May 2006 - 11:29 AM

It doesnt matter where you put it, you put it where you want it to refresh

#10 Indigo

    Official Alien

  • Members
  • PipPipPip
  • 617 posts
  • Gender:Male
  • Location:Trondheim, Norway
  • Interests:Computing in general, especially design and programming of all kinds.

Posted 04 May 2006 - 01:09 PM

But will it echo the text in both of my examples?

Another question:
My MySQL looks like this "MYSQL_QUERY("SELECT * from users WHERE user='$user'and password='$password'") or die ("Wrong username and/or password.");
How can I insert a meta-refresh in that one?

#11 coolaid

    P2L Jedi Master

  • Members
  • PipPipPipPip
  • 1,435 posts
  • Gender:Male
  • Interests:i wonder..

Posted 04 May 2006 - 03:12 PM

for the mysql_query() add teh meta tag afteer the mysql_query()

or put a few seconds delay on the meta tag.

--------

being semantically correct though, a meta tag should be between the <head></head> tags or above all other code... but that dosn't really matter for a quick script-execution page does it?

#12 Chaos King

    Senior Programmer

  • P2L Staff
  • PipPipPip
  • 676 posts
  • Gender:Male
  • Location:Florida

Posted 04 May 2006 - 03:12 PM

What do you mean?

$metaError = '<meta http-equiv="refresh" content="0">';
mysql_query("SELECT * FROM table") or die( $metaError );






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users