makatak88 Posted May 20, 2012 Share Posted May 20, 2012 hello, still very new at this but here goes. on the page that posts the form i have a hidden echo like so. echo "<input type='hidden' name='price' value='$row[price]' />"; on the page that it posts to i have $first_number = $dbh->quote($_REQUEST['price']); $second_number = 20; $sum_total = $first_number + $second_number; $direct_text = 'The two variables added together = '; print ($direct_text . $sum_total); I get 20 as the result. any ideas? also a couple more notes that may help: datatype of price is int in db if i echo out $first_number i get '45' not 45 if i try $newnumber = (int)$first_number; echo $newnumber i get 0 cheers guys Quote Link to comment https://forums.phpfreaks.com/topic/262802-basic-ad-2-ints-from-a-db/ Share on other sites More sharing options...
requinix Posted May 20, 2012 Share Posted May 20, 2012 Why are you quoting the price as if it were about to go into a database? Because it's not about to go into a database. Quote Link to comment https://forums.phpfreaks.com/topic/262802-basic-ad-2-ints-from-a-db/#findComment-1346934 Share on other sites More sharing options...
makatak88 Posted May 20, 2012 Author Share Posted May 20, 2012 at this point its the only way i know to pass that value to the next page. Im learning. Quote Link to comment https://forums.phpfreaks.com/topic/262802-basic-ad-2-ints-from-a-db/#findComment-1346935 Share on other sites More sharing options...
requinix Posted May 20, 2012 Share Posted May 20, 2012 Well... you don't need it. $first_number = $_REQUEST['price']; $second_number = 20; $sum_total = $first_number + $second_number; $direct_text = 'The two variables added together = '; print ($direct_text . $sum_total); Quote Link to comment https://forums.phpfreaks.com/topic/262802-basic-ad-2-ints-from-a-db/#findComment-1346946 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.