Jump to content

basic ad 2 ints from a db


makatak88

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.