472,353 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Meta Refresh does not pass on PHP variable?

I'm trying to get a meta redirect to pass on a php variable to the redirected page, using the $_GET method.

I have the mypage.php?user=created&username=$name&comment=$co mment etc

, but ONLY the first 'user=created' seems to be passed on.

All the other in line, like the username=$name comes from a script where this meta refresh is used, at the bottom.
The script uses sessions, but it never sends the other variables.
Not the original or simple test variables.

The variables does echo during the script, so it must be the meta refresh that are stopping them.

Is this a common problem, or can I fix this somehow?
Jan 2 '10 #1
12 7853
8,658 Expert Mod 8TB
hard to tell without something to look at.
Jan 2 '10 #2
I thought this could be a standard issue, but here is the script stuff:

Expand|Select|Wrap|Line Numbers
  1.         echo "<meta http-equiv='Refresh' content='1;url=mypage.php?user=created&username=$name&password=$pw2&comment=$comment&accesslevel=$accesslevel#msg'> ";

all variables are defined like: $comment=$_POST["comment"];
Everything is sent from a submit form on the same page returning to via the meta refresh.
The URL dont even have the variables filled, so it seems like the meta refresh stops php or something.

Using a different method where i would use $url and echo $url; inside the meta refresh area didnt work. The browser simply said that $url was not found, even though it was defined as a whole url above the meta refresh :/
Jan 2 '10 #3
8,658 Expert Mod 8TB
The URL dont even have the variables filled, so it seems like the meta refresh stops php or something.
due to PHP being a server side language, it has finished working before the HTML is sent to the browser.

what does the meta tag in the HTML look like? (increase the refresh delay sufficiently)
Jan 2 '10 #4
In the sourcecode during the script, it looks like this:

<meta http-equiv='Refresh' content='10;url=mypage.php?user=created&username=b ob&password=bobpw&comment=bobcmt&accesslevel=2#msg '>

So believe it or not, the whole thing actually worked when I increased the refresh delay from 1 to 10.
Does the script need more time than 1 second perhaps? Sounds so strange.
Jan 2 '10 #5
8,658 Expert Mod 8TB
as I already mentioned, the script usually finishes first, before sending the output.
Jan 2 '10 #6
I guess we can say it is working, it just needed 2 seconds to work it seems.

Anyway thanks for the help!
I wouldn't have discovered it if you didn't tell me to increase the refresh delay =)
Jan 2 '10 #7
8,658 Expert Mod 8TB
why do you need the refresh anyway? you could instantly forward using header("Location: $url").
Jan 2 '10 #8
Got a header error :p
Jan 2 '10 #9
8,658 Expert Mod 8TB
this may well be if you’ve never worked with headers before.
Jan 2 '10 #10
I have them lots of places, but I'm not familiar with the technical reasons for the errors themselves, though I've had them before (the errors).

I heard whitespace could be a cause for this error, but in this case it looks fairly implausible.
Jan 2 '10 #11
Your header() probably throws a warning (not an error) because there was already output from the PHP script. Since HTTP headers (that's what it is) must be outputed before any other content, the header command must be given before any output command (like echo/print).
Whitespace is indeed a possibility. Why is that so implausible? Also possible is you just echo'ed something already. You can see that in your HTML (especially then the delay is 10 sec).

Also, I don't believe it matters whether the delay is 0, 1, 2 or 10 seconds. PHP doesn't care about that value. The correct HTML should be printed whatever the HTML is.

Try this (it's neater, if nothing else):
Expand|Select|Wrap|Line Numbers
  1. echo '<meta http-equiv="refresh" content="1;url=mypage.php?user=created&amp;username='.$_POST['name'].'&amp;password='.$_POST['pw2'].'&amp;comment='.$_POST['comment'].'&accesslevel='.$_POST['accesslevel'].'#msg" />';
Jan 2 '10 #12
6,050 Expert 4TB
See this unfinished article.
Jan 2 '10 #13

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

Similar topics

by: Artificial Life | last post by:
urllib2 does not seem to be able to handle META-REFRESH in an html document. I just get back the html to the page that is supposed to forward me to...
by: dan baker | last post by:
I have a page that gets loaded with a meta-refresh hardcoded so that a few things on the page get updated. its kind of a fake chat board. anyway,...
by: Shiperton Henethe | last post by:
Hi Is there anyway to get a meta refresh to do so in an new browser window? e.g. This code forwards this user after 8 seconds... <meta...
by: Tarken | last post by:
Hi, I am trying to do some refactoring of a web site to ensure that it displays in the most web clients possible. One of the pages requires to be...
by: Prodip Saha | last post by:
I am sure there is an easy fix for this problem. I am reloading the same page at an interval using the meta refresh tag in aspx page. This page has...
by: aaa | last post by:
How can I turn a Meta Refresh Tag on and off?
by: joeblast | last post by:
Can someone explain to me why the META Refresh doesn't work in an ASP.NET page? It works just fine in my old asp one! Content value has to be in...
by: helraizer1 | last post by:
Hey. I am making a site as part of a project/presentation. Others used Powerpoint but I decided to make a website with various pages within it. ...
by: Twayne | last post by:
Hi, How would I go about "forcing" a user from one page to another? I have a very simple random question/answer entrance requirement for an...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.