<?php
$var = "arbitrary";
echo <<<_END
<form method = "post" action = "feed.php">
<input type = "text" name = "$var" />
<input type = "submit" />
</form>
_END;
if (isset($_POST['$var']))
{
echo $_POST['$var'];
}
?>
I can’t seem to get this $_POST data when I try to retrieve it from the variable $var. Is this possible? (Getting $_POST from something other than just a string)
Try this:
The issue was just the quoted
$varin your array syntax here$_POST['$var']as others have mentioned. There was nothing wrong with your heredoc syntax, so if you feel more comfortable with HERDOC syntax, you should continue with it.