I have a PHP file with following contents:
<?php
$myflash = $_GET["flashname"];
$mytitl = $_GET["titlname"];
$myqgif = $_GET["flashgif"];
$mytxt = $_GET["txtname"];
?>
<?php
include('01.txt');
?>
It displays properly. But when I use the following:
<?php
include('<?php echo $mytxt; ?>.txt');
?>
It doesn’t display.
is not valid PHP syntax… code inside
<?php ?>is already PHP code. you don’t put more php tags in it.You want to use just:
You have the php tags for PHP code and then one include statement. Inside that statement, you concatenate two strings (
$mytxtand.txt) to form a file name to include.PLEASE make sure to sanitize your input before including it. Someone could easily change the GET parameter and your script would
includeany file they wanted. Make sure the file is where you want it to be before including.