0

I want the 1st line $mc1 value to display in 2nd line .

1st line :

<div id = "score_mdl"><div id = "scml"><?php echo "$mc1"; ?></div><div id = "scmlm">

2nd line :

<?php if ($mc1 == 10) {echo '<div id = "medalg"> want the value here  </div>'; }

i tried the below but no resolution yet

<?php echo $mc1 ?>
echo '$mc1'
echo "$mc1"

2 Answers 2

4

You are looking to do string concatenation. You dont need a second echo statement:

<?php if ($mc1 == 10) {echo '<div id = "medalg">' . $mc1 . '</div>'; }
Sign up to request clarification or add additional context in comments.

Comments

1

Or you can use this notation -

<?php 
    if ($mc1 == 10) {
        echo "<div id = 'medalg'>{$mc1}</div>"; 
}

This reduces concatenation

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.