Oh, okay, here we need to use the " htmlspecialchars() " function to display the code inside of the variable!
<textarea name="code" cols="40" rows="5"><?PHP echo htmlspecialchars($code); ?></textarea><br>
Oh, okay, here we need to use the " htmlspecialchars() " function to display the code inside of the variable!
<textarea name="code" cols="40" rows="5"><?PHP echo htmlspecialchars($code); ?></textarea><br>
still the same error
Sorry, tested it and it does not work that way here either⦠Try the highlight function insteadā¦
<textarea name="code" cols="40" rows="5"><?PHP echo highlight_string($code); ?></textarea><br>
From what I just read that should do it for you.
still the same((( so i guess it is not possible to run that code with in one file
Post the entire page you have now and I will play with it for you. If it will not post, send it in a private message.
You can send files in PMāsā¦
<?PHP
$result = "";
if (isset($_POST['submit'])) {
$code = $_POST['code'];
$result = eval($code);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test Page</title>
</head>
<body>
<form method="post" action="process.php">
<textarea name="code" cols="40" rows="5"><?PHP echo highlight_string($code); ?></textarea><br>
<input type="submit" value="Submit" />
</form>
<h3>Results:</h3>
<?PHP echo $result; ?>
</body>
</html>
it is the whole code I named file process.php , so i could execute it without secod file
This version works for me. Seems you did not have a NAME field in your input clause.
I removed the extra results part and just put the code in place directly using the eval function.
I tested it with this: echo ātesting, 1, 2, 3ā; AND, it worked as it should. Hope this helps you outā¦
<?PHP
$code = "";
if (isset($_POST['submit'])) {
$code = $_POST['code'];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test Page</title>
</head>
<body>
<form method="post" action="codetest.php">
<textarea name="code" cols="40" rows="5"><?PHP echo $code; ?></textarea><br>
<input name="submit" type="submit" value="submit" />
</form>
<h3>Results:</h3>
<?PHP echo eval($code); ?>
</body>
</html>
Shorter and works as-is⦠But, it may not work with any complicated codes⦠Who knowsā¦
and i should name the file codetest.php yes?
No, sorry, that was what I called it. You can name it whatever you want and just put that in the formās action clause⦠Sorry⦠Did it late at nightā¦
working perfectly than you!!
Good for you! You are welcome! Will see you in your next postā¦