0
all right? i’m having the following problem getting a variable in php follows the code:
<?php
$video1="welcome.mp4";
$video2="movie.mp4";
$video3="ends.mp4";
$num_id="1";
$get = '$' . "video" . $num_id;
$file = $get;
echo "<a href=Player.php?file=$file'>Play</a>";
?>
but when I see the result in html the gross variable $video1 appears but I want the result as: Welcome.mp4
HTML Result:
<a href="player.php?file=$video1">Play</a>
HTML - Expectation:
<a href="player.php?file=welcome.mp4">Play</a>
sorry, I hadn’t noticed. I edited the video variables 1, Video2, video3 adding $ but still the case is the same
– Felik Skyer
Try the following
echo "<a href=Player.php?file=" . $file . ">Play</a>";
. Use this contact, so it will put the right value on the variable, before going to view.– Luiz Fernando
did not work. result is: . video .
– Felik Skyer
What you want to do is
$file = ${$get}
, but I see no point in creating that extra variable.– Woss
exactly what I needed really didn’t need this variable "$file" the more was in search to make it work that way with ${$video1} will be perfect in my code now. Thank you all, really.
– Felik Skyer