Page 1 of 1

Value changes after $_GET

Posted: Wed Aug 02, 2006 1:52 am
by Bitweiser
Hello,

I want to open a new window using javascript.

Code: Select all

Popup=window.open("view_result.php?ref="+reference+"&member="+membernumber, "view")
Where member is for example 0654.

Now when the pages opens I'm reading the value with a $_GET[member] statement:

Code: Select all

echo "<B>Member</B>: $_GET[member] )<P>";
Problem: The value has changed from 0654 to 428.

I think it's a decimal/octal problem right? And is there a simple way to work around it?

Thank

Posted: Wed Aug 02, 2006 8:35 am
by feyd
lose the zero.

Posted: Wed Aug 02, 2006 8:42 am
by Bitweiser
feyd wrote:lose the zero.
It's a membernumber so I need to show it in 4 digits.

Ofcourse I can lose the zero and when I've intercepted the values, test to see how many digits I've received and than add the leading zeros again, but then I still don't know why PHP converts my values and if there is a possibility to work around this.

So...anyone?

Posted: Wed Aug 02, 2006 8:44 am
by volka
Somewhere you're using the variable as number where it should be a string (to preserve the zero)

Posted: Wed Aug 02, 2006 8:49 am
by RobertGonzalez
At what point is the nuber changed? Is it in the original display of the id in the link, or after the user clicks the link and submits to the server? Is PHP changing the number or is the script? Do you have processing code you show?

Posted: Wed Aug 02, 2006 10:38 am
by Jenk
Like feyd says, lose the Zero.

Your member numbers are stored as int's, right? None of them will have leading 0's in your DB.

Posted: Wed Aug 02, 2006 10:43 am
by Telius
You could always typecast it as a string.