[thelist] $HTTP_POST_VARS returning incorrect data
Santilal Parbhu
santilal at scorpioneng.co.nz
Fri Nov 30 02:37:00 CST 2007
Hi
I have just met an unusual problem that I haven't met before. I am using
the following code snippet with PHP4 :
if (isset($HTTP_POST_VARS['choose_team'])){
$VV = $HTTP_POST_VARS['team_name']; //An example of this could
be "Lamas,A,34"
$V = explode(',',$VV);
print "Variables are VV = $VV, V[0] = $V[0], V[1] = $V[1], V[2]
= $V[2] "; // This line added for debugging.
$query = "SELECT * FROM $compteams WHERE teams_id = $V[2]"; //
.rest of code.
If the form data is as shown above (Lamas,A,34), $VV is Lamas,A,34. The
explode command works to separate out the string to $V[0] = Lamas, $V[1} = A
and $V[2] = 34.
However, if the form data is Blue Lamas,A,34, then $VV is "Blue" and $V[0] =
Blue and both 4V[1] snd $V[2} are empty. Hence the query does not run.
The $HTTP_POST_VARS seems to truncate the data when it sees the space.
However, I am using the $HTTP_POST_VARS with multi-word data in other places
and it works fine.
Can anyone point me in the right direction?
Thanks.
Santilal
More information about the thelist
mailing list