PDA

View Full Version : echo help


Jupitertrooper
05-14-2008, 09:24 PM
I have been experimenting with a few things and I am making a bit of a calculator.
An example of what I have is

<?php
$1=$_GET["number1"];
$2=$_GET["number2"];

echo "your number is $1*$2";
?>

So my question is simple. When I do it this way, I get the response as written I want the echo to have the $1*$2 to be calculated then echoed with the "Your number is" statement. I tried a bunch of things and nothing works, thanks for the help.

rangana
05-14-2008, 09:41 PM
Don't use number for your variables :disagree:

This should aide:

<?php
$a1=$_GET["number1"];
$a2=$_GET["number2"];
echo 'your number is '.$a1*$a2;
?>

Jupitertrooper
05-14-2008, 11:02 PM
thanks a lot rangana

rangana
05-14-2008, 11:19 PM
No problem, you're welcome :)