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