My code isn't working, what am i doing wrong?
Its a very simple and small script
<textarea name="codebtn" id="code"></textarea>
<input name="code" type="submit" />
</form>
<br>
Result
<br>
<?php
if(isset($_POST["code"])) {
$lol = $_POST["codebtn"];
eval('?>' . $lol .'<?php');
}
?>
This has nothing to do with eval
, and everything to do with your form.
Because <input name="code" />
has no value
attribute, it is not being sent as part of the request, thereby causing isset($_POST["code"])
to fail.
Try:
<input type="submit" name="code" value="lol" />
As an aside, what's wrong with echo $lol
instead of eval?
You're not defining the beginning of form:
<form action="" method="post">
<textarea name="codebtn" id="code"></textarea>
<input name="code" type="submit" />
</form>