How to write as value in a form echo input a $variable which is the result of a calculation


Hi, I have a calculation and the result is stored in a variable $result. Then I have a form with various echo statements. This is one of them:

echo "<td><input type=text name=result value='$result'</td>";

I seem to have the syntax wrong. I’ve done a lot of searches but I didn’t find anything specifically about this, and have tried various possibilities, with different types of brackets, with and without quotes, etc.
Help would be greatly appreciated. Thanks


What’s the error message you get?


You’re missing a closing > for one thing.


Notice : Undefined variable: played in C:\xampp\htdocs\kicktipp2\pointscalc.php on line 123.
This same message applies for five similar lines with different input variables.
Where should the missing > go? Before the td closing tag?



You access a value that doesn’t exist. happens for instance when you initially load a page and try to access POST data.

Rule-that-always-works: Check what you want to work with before you attempt to work with it.