Open techwithtwin opened 1 month ago
You can fix the line containing the paragraph by changing it to:
<p>You want to convert <?php echo $amount; ?> from <?php echo $crypto; ?>.</p>
Or you can use the shorthand syntax as shown by Maxi:
<p>You want to convert <?= $amount ?> from <?= $crypto ?>.</p>
In PHP, you cannot directly evaluate variables inside a literal string like:
"<p>You want to convert $amount from $crypto.</p>"
because it treats the text as a single literal string.
Instead, you need to use PHP tags (<?php ... ?>
) to embed the variables in the HTML, as shown above.
Avoid using single quotes ('
) for interpolation, as they do not parse variables within the string.
` <?php
`
The P tag
<p>you want to convert $amount from $crypto </p>
does not evaluate, and is treated as literal text