Skip to content

Instantly share code, notes, and snippets.

@jeremysells
Last active February 29, 2016 21:16
Show Gist options
  • Save jeremysells/46d3007e8f5563a467ce to your computer and use it in GitHub Desktop.
Save jeremysells/46d3007e8f5563a467ce to your computer and use it in GitHub Desktop.
Showing html escape
<?php
$value = "some\"string'™";
?>
<form name="test" action="<?php echo time(); ?>" method="POST">
<input type="text" value="<?php echo htmlentities($value, ENT_QUOTES, 'UTF-8'); ?>" name="test">
<input type="submit" value="go" name="go" />
</form>
<br/>
<br/>
<p>Note: There is no escaping on the output for demo</p>
<br/>
result = [<?php echo isset($_POST["test"]) ? $_POST["test"] : ""; ?>]
<?php
xdebug_break();
$stop = "ok";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment