PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
harrisonad
Forum Contributor
Posts: 288 Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:
Post
by harrisonad » Thu Apr 21, 2005 5:10 am
Please help me with this.
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
?>
will you tell why this happened?
Last edited by
harrisonad on Thu Apr 21, 2005 5:28 am, edited 1 time in total.
phpScott
DevNet Resident
Posts: 1206 Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.
Post
by phpScott » Thu Apr 21, 2005 5:27 am
One of 2 possible reasons.
1) $_POST['employeeid'] doesn't have a value.
2) function getDetials doesn't know about your $_POST values, but this is unlikely as %_POST is a global variable.
Last edited by
phpScott on Thu Apr 21, 2005 5:54 am, edited 1 time in total.
harrisonad
Forum Contributor
Posts: 288 Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:
Post
by harrisonad » Thu Apr 21, 2005 5:32 am
but what if a put a:
in getDetails function, will it make sense?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Thu Apr 21, 2005 7:25 am
$_POST is actually a superglobal so will work within a function in any case...
Have you tried
Just so you know that you're getting what you believe should be transferred ?