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 1107483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:56:37+00:00 2026-05-17T01:56:37+00:00

Hey, I’ve got what has become an extremely frustrating problem with $_Post variables. I’ll

  • 0

Hey, I’ve got what has become an extremely frustrating problem with $_Post variables. I’ll give examples of code rather than the actual segments to save time and confusion. On one page I’m doing this:

<? echo "<form name='form' action='page.php' method='post'>
         <input type='hidden' name='slot' value=".$i.">
         </form>";
?>

The $i is an index in a while loop (I’m echoing this simple form several times). The form itself is submitted with a bit a javascript.

All’s well at this point, the form is submitted properly and takes me to another page, where I need to use that “slot” value to do some other junk. However, when I try to do this:

<? echo "<form name='another_form' action='another_page.php' method='post'>
         <input type='hidden' name='slot_num' value=".$_POST['slot'].">
         //SOME OTHER HIDDEN VARS
         </form>";
?>

or this…

<? echo "<form name='another_form' action='another_page.php' method='post'>
         <input type='hidden' name='slot_num' value=";
         echo $_POST['slot'];
          echo ">
         //SOME OTHER HIDDEN VARS
         </form>";
?>

or this…

<? //TOP OF PAGE
$slots = $_POST['slot'];
?>

<? //FURTHER DOWN
<? echo "<form name='another_form' action='another_page.php' method='post'>
     <input type='hidden' name='slot_num' value=".$slots.">
     //SOME OTHER HIDDEN VARS
     </form>";
?>

…all I get is an Undefined index: slot etc.. etc… error, and source of the php document just has blank space. Funny thing is, if I simply do this:

echo $_POST['slot'];

at the top of the page, it prints out the value from the previous page just fine, however, if I view the source, it still shows an Undefined index error instead of the value. I KNOW the value is getting passed because it prints, but I can’t use it for anything else because if I try to include it in my php code, it just displays an error and gives a blank value!

I’ve also tried using $HTTP_POST_VARS[‘slots’] with the same result… I am at wits end after several hours of experimentation… any advice?

  • 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-05-17T01:56:38+00:00Added an answer on May 17, 2026 at 1:56 am

    Edit:

    Based on your comments and posted code, you seem to be trying to echo $_POST['slot'] when you should be echoing $_POST['slots']… note the s at the end.


    Since $_POST is a super global, it is available anywhere on your page, so your code should work.

    I noticed that you mixed slot and slots as the index in you post (you wrote $HTTP_POST_VARS['slots'] as the last example and $_POST['slot'] everywhere else). Could that be the reason?

    To check what $_POST looks like, try this right about where you want to print the hidden value (though it should work the same anywhere on your page):

    <?php
    echo "<pre>";
    print_r($_POST);
    echo "</pre>";
    ?>
    

    Also, your slot isn’t being echoed with quote marks around it, so it should be:

    <?php echo "<form name='another_form' action='another_page.php' method='post'>
             <input type='hidden' name='slot_num' value='".$_POST['slots']."'>
             //SOME OTHER HIDDEN VARS
             </form>";
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
hey guys having this really simple problem but cant seem to figure out have
Hey its really hard to define an exact title for my problem. I am
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey I can't figure out an error I got. I had my App working
Hey everyone I am a newbie and would love some help. I got the
Hey people I've been searching over the internet for the following problem without success...
Hey I am getting index out of bounds error in my code. From Activity:
Hey guys I'm running this code in Android: public ServiceServer(String serverName) { this.serverName =
Hey, I have a problem sharing a link on twitter: data-url=http://ipofmywebsite/mypage/?some_id=276&some_name=b+a As I put

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.