...

View Full Version : header redirecting but included file is not working



clem_c_rock
05-06-2009, 09:01 PM
Hello, I have a script that is supposed to redirect to the same page but pass a get parameter to flag which partial is included on the page.

The redirect is working and the section where the template is to be included is entered but it's still showing the previous template. It's almost like
the include is getting ignored.

Sample code:



$update = $db->create_update("prescriptions", $_POST, null, "id =". $_POST['prescription_id']);
if($update){ header("Location: prescription.php?step=1"); exit; }

include_once(BASE_PATH ."/templates/cpanel/prescription.tmpl.html");



and here's the code in the prescription.tmpl.html template:


<body leftmargin="10" topmargin="10" marginwidth="10" marginheight="10">

<?php if($step == 1){ echo "INCLUDING TEMPLATE 1 HERE"; include(BASE_PATH ."/templates/cpanel/prescription_1.tmpl.html"); } ?>
<?php if($step == 2){ include(BASE_PATH ."/templates/cpanel/prescription_2.tmpl.html"); } ?>

</body>
</html>



After the redirect, prescription_2.tmpl.html is still showing even though the if section where prescription_1.tmpl.html is to be included is entered.

Very strange - any ideas?

Thanks,
Clem C

venegal
05-06-2009, 09:33 PM
Well, is the second if section also entered?

clem_c_rock
05-07-2009, 04:50 AM
no -it's not entered at all. I definitely checked for that.

CFMaBiSmAd
05-07-2009, 04:57 AM
GET parameters on the end of the URL are available as a $_GET variable. You must use $_GET['step']



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum