faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 20 people (40%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How can I have a user submit PHP script like <? echo $variable ?> using an textarea field?

Mar 23rd, 2001 13:54
Ben Udall, Andy Nash, http://www.php.net/manual/en/function.eval.php


The eval() function is probably what you want. It allows you to 
interpret a php string as php code. For example:
$php_code = "echo 'Hello world';";
eval($php_code);