Scope problem
Posted: Thu Apr 21, 2005 5:10 am
Please help me with this.
will you tell why this happened?
Code: Select all
<?php
$appid = $leavetype = $employeeid = $jobtitle = $companydept = $fromdate = $todate = $reason = $depthead = '';
function getDetails(){
global $appid,$leavetype,$employeeid,$jobtitle,$companydept, $fromdate,$todate,$reason,$depthead;
$employeeid = $_POST['employeeid'];
$datefiled = $_POST['datefiled'];
$jobtitle = $_POST['jobtitle'];
$companydept = $_POST['companydept'];
$leavetype =$_POST['leavetype'];
$fromdate = $_POST['from_year']."-".$_POST['from_month']."-".$_POST['from_day'];
$todate = $_POST['to_year']."-".$_POST['to_month']."-".$_POST['to_day'];
$reason = $_POST['reason'];
$superiorid = $_POST['superiorid'];
$deptheadid = $_POST['deptheadid'];
if($type=='edit')
$appid = $_POST['appid'];
}
getDetails();
echo $employeeid; // This returns NULL
?>