Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7949167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:55:05+00:00 2026-06-04T01:55:05+00:00

<?php $var = arbitrary; echo <<<_END <form method = post action = feed.php> <input

  • 0
<?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)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:55:06+00:00Added an answer on June 4, 2026 at 1:55 am

    Try this:

    <?php
    
    $var = "arbitrary";
    
    ?>
    
    <form method = "post" action = "feed.php">
    
        <input type = "text" name = "<?php echo $var ?>" />
        <input type = "submit" />
    
    </form>
    
    <?php
    
    if (isset($_POST[$var]))
    {
        echo $_POST[$var];
    }
    
    ?>
    

    The issue was just the quoted $var in 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My flash code: var request=new URLRequest('http://localhost/test.php'); request.method = URLRequestMethod.POST; var data = new URLVariables();
Consider this simple example; <?php $text = test; ?> <script type=text/javascript defer=defer> var test;
I have this following code $(function () { $.post(fetch_data.php?url=+$('#url').val(), { }, function(response){ var arrValues
So I call this PHP script from the command line: /usr/bin/php /var/www/bims/index.php projects/output and
In this code: <?php class Foo { var $value; function foo($value) { $this->setValue($value); }
Lets say I have this code: <?php class hello { var $greeting = hello;
I am compressing an image using following class.. <?php class SimpleImage { var $image;
I come from PHP background and am used to doing var_dump , echo and
I can access a PHP var with Javascript like this: <?php $fruit = apple;
Consider a PHP script that outputs all POST data, as follows: <?php var_dump($_POST); ?>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.