Page 1 of 1

$_POST problem

Posted: Sat Feb 26, 2011 3:07 pm
by ramonypp
I wrote this code ;
<?php
$one = $_POST['one'];
$two= $_POST['one'];
$op= $_POST['sum'];

if($op=="sum")
{
print $one;
print $two;
print $one+$two;
}
?>
my problem is when i started the browser, $one and $two shown normally, but $one+$two shown zero,0
why is it so? anyone to help me?

Re: $_POST problem

Posted: Sat Feb 26, 2011 3:30 pm
by ramonypp
i found out, variables are type of string, although i casted to int them, no change happend
Note: I get the values from Flash

Re: $_POST problem

Posted: Sun Feb 27, 2011 12:24 am
by social_experiment
ramonypp wrote:i found out, variables are type of string, although i casted to int them, no change happend
All form input are string.
ramonypp wrote:my problem is when i started the browser, $one and $two shown normally, but $one+$two shown zero,0
Could you paste the form code too. Not sure if you made a typo here, but your $two variable is also assigned the value of $_POST['one'].