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?
$_POST problem
Moderator: General Moderators
Re: $_POST problem
i found out, variables are type of string, although i casted to int them, no change happend
Note: I get the values from Flash
Note: I get the values from Flash
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: $_POST problem
All form input are string.ramonypp wrote:i found out, variables are type of string, although i casted to int them, no change happend
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'].ramonypp wrote:my problem is when i started the browser, $one and $two shown normally, but $one+$two shown zero,0
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering