laserlight;10889190 wrote:In this case, no, since it is within a string literal.
crawfd, perhaps you should post the smallest and simplest script that demonstrates the problem.
I have to disagree with you laser
He must have quotes around the index
laserlight;10889190 wrote:In this case, no, since it is within a string literal.
crawfd, perhaps you should post the smallest and simplest script that demonstrates the problem.
I have to disagree with you laser
He must have quotes around the index
efficacious;10889192 wrote:I have to disagree with you laser
He must have quotes around the index
The PHP Manual agrees with me. Check out the entry on the string type, in particular the section on Variable parsing.
Nah I had tried that, doesn't matter if there is a quote around the index or not. Tried the below but still isn't echo'ing the msg2 variable......this is weird. I get nothing at all.
header("location:http://www.addresss.com/usr/member.php?id=$_SESSION[MemberID]&t=feed&msg2=No+Reference+to+our+site+can+be+found+at+this+address");
// Next PAge where trying to pick up variable
<td valign="top"><? echo "$_GET['msg2']";?><input name="dest" type="text" id="dest" size="55" /></td>
sry i'm not finding the section that agrees with you.. in fact I don't see a section about indexes at all
crawfd , laser is correct about you needing to post more of the code.. we need to see what other code is interacting with this code so we will be more likely to spot a conflict
Tried the below but still isn't echo'ing the msg2 variable......this is weird. I get nothing at all.
crawfd's example is rather confusing: those two lines are code are actually supposed to be in different PHP script files (or in the same file, but the access of $_GET['msg2'] only happens after a redirect to the same file).
sry i'm not finding the section that agrees with you.. in fact I don't see a section about indexes at all
Search for "Variable parsing", then scroll past the "Simple syntax" sub-section. In particular, observe this line of example code:
// Works, but note that this works differently outside a string
echo "A banana is $fruits[banana].";my fault laser I did test that theory and your correct it will work without the quotes around the index..
funny.. i've always gotten errors because of it..
regardless of that I would still use them ...
I didn't find it confusing.. it says in a comment that its on a different page.
funny.. i've always gotten errors because of it..
That's probably because you used that syntax outside of a string literal, in which case the unquoted string index is technically supposed to refer to a defined constant, though the PHP interpreter is forgiving and will consider it a string if there is no such constant, emitting a warning in such a case.
I'll attempt to explain my situation.
My echo variable in Page 2 is code nested in a Ajax results page (but from my experience with variable this should play no effect because the variable is still in the URL query string? It's not like it's a hidden or Post variable that's lost.
When I'm redirected from Page 1 to Page 2, the msg2 variable is explicitly in the query string.
Is Ajax effecting this redirect and the nature of the query string retrieval?
I'm not really even sure I can explain this any further. Like I said I'm seeing the redirect URL in the query string. And the html I pasted in the results page is the code I have for the echo ....
//Page 1
header("location:http://www.addresss.com/usr/member.php?id=$_SESSION[MemberID]&t=feed&msg2=No+Reference+to+our+site+can+be+found+at+this+address");
//Page2
<td valign="top"><? echo "$_GET[msg2]";?><input name="dest" type="text" id="dest" size="55" /></td>
efficacious wrote:I didn't find it confusing.. it says in a comment that its on a different page.
Ah, I thought that you were the one who posted that reply.
crawfd wrote:Is Ajax effecting this redirect and the nature of the query string retrieval?
hmm... what do you get when you print $_SERVER['QUERY_STRING']?
aha! when I echo the query string the only thing I get is
id=1
but my URL string says ...........
http://www.mysite.com/usr/member.php?id=1&t=feed&msg2=No+Reference+to+our+site+can+be+found+at+this+address
Should I not add the pluses in the msg2 variable and leave the blank spaces in the redirect code? Why isn't it echo'ing the other variable in the url string?
I don't ever add any extra things to variables when I post via GET But is that really the problem?
specially if its returning id=1... thats a huge difference for just adding some plus signs
I don't ever add any extra things to variables when I post via GET But is that really the problem?
specially if its returning id=1... thats a huge difference for just adding some plus signs
Should I not add the pluses in the msg2 variable and leave the blank spaces in the redirect code? Why isn't it echo'ing the other variable in the url string?
The pluses seem fine since there should be no problem interpreting them as spaces. Of course, you could test with:
header('location: http://www.mysite.com/usr/member.php?id=1&msg2=test');
exit;Solved the problem. The T variable in my query string was put into place to active a Tab that uses ajax. I had to also put those variable in the query string in the ajax code, so that it could relay to the other page correctly.....sorry all.
Ah, no wonder the problem seemed so strange. Okay then, remember to mark this thread as resolved using the thread tools.