I am trying to add <?php ?> tags via my input boxes w/c is stored into the database.
But when i open the page, the <?php ?> tags are not parsed and are being shown in PINK and i believe is a COMMENT already. Why is that?
Printable View
I am trying to add <?php ?> tags via my input boxes w/c is stored into the database.
But when i open the page, the <?php ?> tags are not parsed and are being shown in PINK and i believe is a COMMENT already. Why is that?
It's the same reason this happens:
Except instead of '<?php echo "hello, world!"; ?>' it's something from the database with '<?php .. ?>'.PHP Code:<?php
echo '<?php echo "hello, world!"; ?>';
?>
PHP isn't trying to parse it, (x)HTML is. To (x)HTML it's gibberish, or XML
ooh okaaay :) thanks.
so, what i did was go, " ?> <?php ?>" LOL, i thought it would end the 1st php tags, but it just showd "?>" as string, and <?php ?> is still in pink..
is there any thing i can do to make this work? or it can only be done if i have ftp/backend/ssh access?
Could you maybe show us the code where the problem is occurring? Not sure if I'm understanding your problem D:
You can run a php code by include it instead of printing it. If you are trying to run the code from the input you may want to check out `eval`. Be aware that evaluating code from the input exposes you to major security threats.
what im getting at with your problem is that you want to display php code on your site through a php file.
look into: PHP: htmlspecialchars - Manual
Adding onto that:
PHP: highlight_string - Manual
PHP: highlight_file - Manual
PHP: php_check_syntax - Manual
I wasn't thinking in terms of showing the PHP code on a web-site, (which isn't parsing). But if you are, there's a lot of tools available.
uploading a php code to a database to later have that code be the actual code for that page is illogical. your asking to the worst possible stuff the happen to your site possible.
if your trying to achieve something dynamic, look into GET and require/include for the pages with mysql ties.