Re: can't get the $_GET['id'] after the header is sent but page doesn't redirect



On Jan 6, 5:41 pm, Paul Herber <SubstituteMyFirstNameH...@xxxxxxxxxxx>
wrote:
On Tue, 6 Jan 2009 17:10:55 -0800 (PST), JRough <jlro...@xxxxxxxxx>
wrote:

     Header("Location: ".$_POST['redirect'].".php?id=".$_POST['id']);
   Header("Location:  current_sightingsXL.php?id=".$_GET:['id']);

POST or GET?

--
Regards, Paul Herber, Sandrila Ltd.  http://www.sandrila.co.uk/ ;        

The first else if is a post. I asked this question last week. I am
not fully sure why but there is a post in the page source.
The second one is a get. The reason is there is no more post on the
xl page so it should be a get but since the header only gets sent
there and the page doesn't get redirected there I don't know. Here is
the page source. I noticed there is one missing </form> tag. There
should be two forms. One for the selection and one for the excel
post.
table>
<th><a href='current_sightings.php?id=117&order_by=l_e'>L_E</a></
th>
<th><a href='current_sightings.php?id=117&'>Carnumber</a></th>
<th>Type</th>
<th><a href='current_sightings.php?
id=117&order_by=location'>Location</a></th>

<th><a href='current_sightings.php?
id=117&order_by=sighting_date'>Sighting Date</a></th>
<th><a href='current_sightings.php?
id=117&order_by=classification'>Code</a></th>
<th><a href='current_sightings.php?id=117&order_by=railroad'>RR</
a></th>
<th><a href='current_sightings.php?id=117&order_by=origin'>Origin</
a></th>
<th><a href='current_sightings.php?
id=117&order_by=destination'>Destination</a></th>
<th><a href='current_sightings.php?id=117&order_by=eta'>ETA</a></
th><tr >

<td align='center'>E</td>
<td><a href='clm_history.php?mark=ALLX&num=3211'>ALLX003211</a></
td>
<td align='center'>LO</td>
<td>UNIBRIDGE, MD</td>
<td>07-09-2008 04:05 PM</td>
<td>Actual Placement</td>

<td>MMID</td>
<td>BALPENMAR, MD</td>
<td>UNIBRIDGE, MD</td>
<td align='center'>at destination</td>
</tr><tr class='trbg'>
<td align='center'>L</td>
<td><a href='clm_history.php?mark=ALLX&num=3244'>ALLX003244</a></
td>

<td align='center'>LO</td>
<td>ALSEN, NY</td>
<td>07-09-2008 01:00 PM</td>
<td>Arrival at Destination</td>
<td>CSXT</td>
<td>CURBAY, MD</td>

<td>ALSEN, NY</td>
<td align='center'>at destination</td>
</tr><tr class='trbg'>
<td align='center'>L</td>
<td><a href='clm_history.php?mark=ALLX&num=3264'>ALLX003264</a></
td>
<td align='center'>LO</td>
<td>ALSEN, NY</td>


<td align=center>

<form action ="/current_sightings.php" method=post>

<INPUT TYPE = "image" SRC='http://www.allcapitalrail.com/
images/excel3.jpg'
VALUE ="Open in Excel" ALT="Open in Excel" NAME="assign"></
form>
</tr>
This is after a selection is made.

Here also is the current_sightingsXL.php page. It does work. It is
the internal user. The one on this page is a GET and it needs to GET
it from the url and it isn't there and I CAN'T FIGURE OUT WHY.

Validate_login("current_sightings.php");


switch ($_SESSION["LMS_USER_DESC"]){
case "customer":
$id = $_SESSION["LMS_LOGGED_IN"];
$result = SELECT_sightings_customercars($id,CLM_order_by
($order_by));
break;
case "internal":
$lease_id = $_GET['id'];
$result = SELECT_sightings_leasecars($lease_id,CLM_order_by
($order_by));
break;
case "owner":

$result = SELECT_sightings_ownercars($lease_id,CLM_order_by
($order_by));
break;
}


$xclheader = array(
'Lease_Number',
'L_E',
'Carnumber', '',

'Location','' ,'Sighting_Date',

'Code',

'Railroad', 'Origin','',
'Destination','' ,

'ETA'
);
$xclfields = array(
'lease_num',
'l_e',
'car_mark','car_number',

'location_city','location_state','sighting_date',
'classification','railroad', 'origin_city','origin_state',
'destination_city', 'destination_state',

'eta');



$file_name = "Current_Sightings";




$header = makexclheader($xclheader);
$data = makexcldata($xclfields,$result);


if (empty($data)) {
$data = "\n(0) Records Found!\n";}
header("Content-type: application/xmsdownload");
header("Content-Disposition: attachment; filename=".$file_name.date
("Y:m:d H:i").".xls");
header("Pragma: no-cache");
header("Expires; 0");

print "$header\n$data";



function makexclheader($xclheader){
$str = '';
if (strlen($xclheader) !== 0);
for ($i=0; $i <sizeof($xclheader); $i++){
$str .= $xclheader[$i];
$str .= "\t";
}
$str . "\n";
return $str;
}

function makexcldata($xclfields,$result){
$numrows = mysql_num_rows($result);
$rowcount =1;
if ($result && mySQL_num_rows($result)){
while ($row = mysql_fetch_assoc($result)){
for($i =0; $i < sizeof($xclfields);$i++){
$value .= $row[$xclfields[$i]] ;
$value .= "\t";
}

$value .= "\n";

}
$data = $value;
return $data;
}
}

thanks,
.