phplee Posted May 19, 2004 Share Posted May 19, 2004 <?php $ans = $_POST[first] $_POST[calc] $_POST[second]; $message = ""; if (!isset($_POST[first]) == here) { $message = "Welcome to the math machine"; } elseif (($_POST[first]) == ($_POST[first])) { $message = "$_POST[first] $_POST[calc] $_POST[second] = $ans"; } ?> this a peice of code from a test page i am trying out. $_POST[first] $_POST[calc] $_POST[second]; these are user inputs, they would make, E.G. 4 + 4, i want this to complete so that when i put $ans in my code it will give me 8, not 4 + 4. any help on this matter will help me very much, and is much apreciated. thanks loads lee Quote Link to comment https://forums.phpfreaks.com/topic/1848-php-arithmic-trouble/ Share on other sites More sharing options...
Milshak Posted May 20, 2004 Share Posted May 20, 2004 I think what's happening is that $ans is an array and the user imputs are separate elements try to concatinate the user imput try this $ans = $_POST[first] .$_POST[calc] .$_POST[second]; note the periods Quote Link to comment https://forums.phpfreaks.com/topic/1848-php-arithmic-trouble/#findComment-6041 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.