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

  • Home
  • SEARCH
  • 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 8079401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:05:21+00:00 2026-06-05T16:05:21+00:00

I wonder whether someone may be able to help me please. Firstly apologies as

  • 0

I wonder whether someone may be able to help me please.

Firstly apologies as I am new to this, so to some this may seem a very basic error.

I’m using the form below to allow users to navigate between different pages all based around a ‘Location’ record.

<form name="locations" id="locations" method="post" action="locationsaction.php">

    <?php

        <table width="538" border="0">
        <tr>
        <th width="119"><div align="left">Location Name</div></th>
        <th width="159"><div align="left">Address</div></th>
        <th width="94"><div align="center">No. Of Finds</div></th>
        <th width="69"></th>
        <th width="66"></th>
        <th width="5"></th>

        </tr>
        <tr>
        <td><div align="left"><?php echo $lid;?></div></td>
        <td><div align="left"><?php echo $lname;?></div></td>
        <td><div align="left"><?php echo $laddress;?></div></td>
        <td><div align="center"><?php echo $findscount?></div></td>
        <td><div align="center"><input name="type" type="submit" value="View Details"/></div></td>
        <td><div align="center"><input name="type" type="submit" value="Add Finds"/></div></td>
        <td><div align="center"><input name="type" type="submit" value=" Add Images"/></div></td>
        </tr>
        <tr><th colspan="8"><br/><hr width="100%"></th></tr>
        </table>
        <?php
</form>

At the end of the form you will notice that there are three ‘Submit’ buttons which takes the user to different pages. The following PHP script is used to determine which button has been selected and is shown in the above Form POSTaction as locationsaction.php

<?php
if (isset($_POST['type'])) {
    $urls = array(
        'View Details' => 'updatelocation.php',
        'Add Finds' => 'addfinds.php',
        'Add Images' => 'image.php'
    );
    $url = $urls[$_POST['type']];
    header("Location: " . $url);
}
?>

Although the buttons work fine, as in they take the user to the correct page, I cannot get the $lid variable to be passed to any of the three receiving pages and I receive the following error:
Notice: Undefined index: lid in /homepages/2/d333603417/htdocs/updatelocation.php

This is how I’m trying to get the $lid variable in all my receiving pages:

$lid = $_POST['lid'];

I’ve looked through several tutorials and posts on this site, and I can’t find out where I’m going wrong.

I just wondered whether someone could have a look at this and let me know where I’m going wrong?

Many thanks and kind regards

  • 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-05T16:05:23+00:00Added an answer on June 5, 2026 at 4:05 pm

    First, put the $lid variable in an input:

    <input type="hidden" name="lid" value="<?=$lid?>" />
    

    Otherwise it won’t be posted in the form.

    Also, when you redirect, the POST variables won’t be redirected with you. You can either append them to the url (http://url.tld?lid=value), and then get at them like so:

    $lid = $_GET['lid'];
    

    However, a better way might be to save them in a session:

    $_SESSION['lid'] = $_POST['lid'];
    // Redirect here
    

    Then on the next page, you can access them:

    $lid = $_SESSION['lid'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly my apologies.
I wonder whether someone may be able to help me please. Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly, this is
I wonder whether someone may be able to help me please. Firstly, apologies because
I wonder whether someone may be able to help me please. Firstly apologies, because
I wonder whether someone may be able to help me please. Firstly, apologies, I'm
I wonder whether someone may be able to help me please. Using some excellent
I wonder whether someone may be able to help me please. From some demos
I wonder whether someone may be able to help me please. I'm using this

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.