1

What would be the correct way to put a PHP variable inside HTML that is equal to a PHP variable? Sorry if that's a bit confusing, here's what I mean:

$v = '<center><embed width="420" height="236" src="<?= $pcv ?>" type="application/x-shockwave-flash"></embed></center><hr>';

2 Answers 2

5

The simplest way would be to use concatenation.

 $v = '<center><embed width="420" height="236" src="'.$pcv.'" type="application/x-shockwave-flash"></embed></center><hr>';
Sign up to request clarification or add additional context in comments.

Comments

2

John's answer is my favourite, but an alternative:

<center>
   <embed width="420" height="236" src="<?php echo $pcv; ?>" type="application/x-shockwave-flash">
   </embed>
</center>
<hr/>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.