Re: get or post



JRough wrote:
On Dec 30, 7:45 pm, FutureShock <futuresho...@xxxxxxx> wrote:
Acutally I was wrong....PHP_SELF should return the doc path.

http://example.com/members/test.php

will return '/members/test.php'

Scotty

So that means the id does get posted for the "all cars". That means
it is available on any page in the session. It is posting it through
the url not through the form. Is that why it doesn't matter that the
end </form> tag was missing and it worked anyway? So that is not the
problem then. For some reason my redirect to the excel page works for
the customer user and not the internal or owner user. It does not
redirect to current_sightingsXL.php in the case of the owner or
internal user only the customer user. The only other difference
between those 2 users and the customer user is the select_lease_num
(leaseID) & select_comp_name(leaseID) functions.

Validate_login("current_sightings.php");

if(empty($id)&&($_SESSION["LMS_USER_DESC"]=='internal'||$_SESSION
["LMS_USER_DESC"]=='owner')){
# THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER
SUB GROUPS OR MANAGED CARS
$destroyed = GetDestroyed_lease_id();
$result = Get_leasesCLM();
$TPL_ids = "<SELECT name='id' class=box size=8>\n";
$trbg = "";

while($row = mysql_fetch_assoc($result)){
$id = $row['lease_id'];
$lnum = $row['lease_num'];
$comp = $row['comp_name'];

$trbg = GetTRBG($trbg);

$TPL_ids.=" <OPTION VALUE='".$id;
$TPL_ids.="' ".$trbg.">".$lnum." - ".$comp."</OPTION>\n";
}

$TPL_ids.="</SELECT>\n";



include "header.php";
include $template_path."current_sightings_php.html";



}elseif($_POST['redirect']&&$_POST['redirect']!=$_SERVER['PHP_SELF']){
Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);


exit;
}elseif($_POST['assign']=='Open in Excel'){
#Header("Location: http://allcapitalrail.com/current_sightingsXL.php";);
Header("Location: http://allcapitalrail.com/current_sightingsXL.php?id=".$_POST['id']);

exit;



}else{

# DETERMINE PAGE ACCORDING TO USER TYPE
switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];

$MSG_carlist = "CURRENT SIGHTINGS";
$result = SELECT_sightings_customercars($id,CLM_order_by
($order_by));
break;
case "internal":


$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_leasecars($id,CLM_order_by
($order_by));
break;
case "owner":



$MSG_carlist = "CURRENT SIGHTINGS FOR ".SELECT_lease_num($id)."
".SELECT_comp_name($id);
$result = SELECT_sightings_ownercars($id,CLM_order_by
($order_by));
break;
#case "internal_ltd":
# break;
}
$TPL_carnumbers = GetTableHeaders($id);
while ($row = mysql_fetch_assoc($result)){
$TPL_carnumbers.=MakeSighting($row);
}
$TPL_carnumbers.="</table>";




include "header.php";
include $template_path."template_carlist.html";
include "footer.php";

}

-------------
function SELECT_lease_num($lease_id){

$query = "SELECT m.lease_num
FROM INTERNAL_MASTER_LEASE m, INTERNAL_LEASES l

WHERE l.lease_id =".$lease_id."
AND l.master_lease_id = m.master_lease_id";
$result = mysql_query($query);
if(!$result){
MySQLError($query);
exit;
}
$row = mysql_fetch_row($result);
return $row[0];
}

function SELECT_comp_name($lease_id){
$query = "SELECT comp_name
FROM INTERNAL_LEASES l, INTERNAL_MASTER_LEASE m, INTERNAL_COMPANY
c
WHERE l.lease_id = ".$lease_id."

AND l.master_lease_id = m.master_lease_id
AND m.comp_id = c.comp_id";
$result = mysql_query($query);
if(!$result){
MySQLError($query);
exit;
}
$row = mysql_fetch_row($result);
return $row[0];
}

With this statement:

}elseif($_POST['assign']=='Open in Excel'){
#Header("Location: http://allcapitalrail.com/current_sightingsXL.php";);
Header("Location: http://allcapitalrail.com/current_sightingsXL.php?id=".$_POST['id']);

exit;


I don't see from this page or the last form where you are setting a $_POST variable to 'Open in Excel'.


If you could post the entire page, it may be easier to decrypt.

Scotty

PS: I hate templates.
.



Relevant Pages

  • Re: get or post
    ... So that means the id does get posted for the "all cars". ... the customer user and not the internal or owner user. ... $query = "SELECT m.lease_num ...
    (comp.lang.php)
  • Re: get or post
    ... the customer user and not the internal or owner user. ...   # THIS IS id INSTEAD OF lease_id B/C ONE DAY WE MIGHT HAVE CUSTOMER ...     exit; ... $query = "SELECT m.lease_num ...
    (comp.lang.php)
  • RE: Breaking down imported information
    ... Single-record append query: ... ' Check if at EOF of Recordset (rsDataViaCode) ... ' if at EOF Exit Do. ... Dim rsDataViaCode As DAO.Recordset ...
    (microsoft.public.access.modulesdaovba)
  • RE: Form Code to update the table
    ... way I have not made fancy yet, once code and everything is set up, I will try ... At the bottom of the form I have created two buttons – update and Exit. ... "Jack Leach" wrote: ... Make a query, qryResources, which returns all the fields in table ...
    (microsoft.public.access.formscoding)
  • RE: Form Code to update the table
    ... At the bottom of the form I have created two buttons – update and Exit. ... "Jack Leach" wrote: ... Make a query, qryResources, which returns all the fields in table ... set the Recordsource property to qryResources. ...
    (microsoft.public.access.formscoding)