|
 |
beginning_php thread: Code for Loan Application Form wonīt work.
Message #1 by cyberjoe@t... on Wed, 29 May 2002 22:01:09
|
|
Iīve been having a lot of difficulty getting code to work. My php4 version
is 4.1.2 and instead of using $variable (due to the fact that
register_globals is switched off by default in this and later versions)I
have to use either $_GET["variable"]; or $_POST["variable"]; depending on
the method used. I keep coming across code in the book that simply wonīt
work because the authors didnīt take that detail into account. I just
donīt know how to go about it.The code snippet is the following:
<HTML>
<HEAD></HEAD>
<BODY>
<B>Namllu Credit Bank Loan Application Form</B>
<BR>
<BR>
<?
$SalaryAllowance = $Salary/5;
$AgeAllowance = ($Age/10 - ($Age%10)/10)-1;
$LoanAllowance = $SalaryAllowance * $AgeAllowance;
echo "Loan wanted:$Loan<BR>";
echo "Loan amount we will allow:$LoanAllowance<BR><BR>";
if ($Loan <= $LoanAllowance) echo "Yes, $FirstName $LastName, we are
delighted to accept your application";
if ($Loan > $LoanAllowance) echo "Sorry, $FirstName $LastName, we cannot
accept your application at this time";
?>
</BODY>
</HTML>
Can anyone please help me? Does anyone know whether or not the authors
have already realized how difficult itīs been for readers to keep trying
to figure out how to get the examples to work?
Thanks in advance,
Joe
Message #2 by "John Arbon" <subscriptions@c...> on Thu, 30 May 2002 01:01:21
|
|
Joe,
What book, what page? Unfortunately many authors make some assumptions
about information that really should be included.
It appears that you are trying to pass the values for:
$age, $salary, $FirstName, $LastName, $Loan
to this code that you included in your post.
With your globals off have you implemented the $_GET, or $_POST ?
Is this code not working for you and you are asking how to use the $_GET
and $_POST variables?
John
> Iīve been having a lot of difficulty getting code to work. My php4
version
i> s 4.1.2 and instead of using $variable (due to the fact that
r> egister_globals is switched off by default in this and later versions)I
h> ave to use either $_GET["variable"]; or $_POST["variable"]; depending
on
t> he method used. I keep coming across code in the book that simply wonīt
w> ork because the authors didnīt take that detail into account. I just
d> onīt know how to go about it.The code snippet is the following:
> <HTML>
<> HEAD></HEAD>
<> BODY>
<> B>Namllu Credit Bank Loan Application Form</B>
<> BR>
<> BR>
<> ?
$> SalaryAllowance = $Salary/5;
$> AgeAllowance = ($Age/10 - ($Age%10)/10)-1;
$> LoanAllowance = $SalaryAllowance * $AgeAllowance;
e> cho "Loan wanted:$Loan<BR>";
e> cho "Loan amount we will allow:$LoanAllowance<BR><BR>";
i> f ($Loan <= $LoanAllowance) echo "Yes, $FirstName $LastName, we are
d> elighted to accept your application";
i> f ($Loan > $LoanAllowance) echo "Sorry, $FirstName $LastName, we cannot
a> ccept your application at this time";
?> >
<> /BODY>
<> /HTML>
> Can anyone please help me? Does anyone know whether or not the authors
h> ave already realized how difficult itīs been for readers to keep trying
t> o figure out how to get the examples to work?
> Thanks in advance,
> Joe
Message #3 by cyberjoe@t... on Thu, 30 May 2002 01:15:43
|
|
Hi John,
Thanks for replying,
Well, the book is "Beginning php4".(I thought this forum was aimed at
readers of that book).I cannot really tell you which page it is as Iīm
reading the Portuguese version and you probably have the English one so
the pages are not likely to coincide, I suppose.Anyway, Iīm talking about
the last example in chapter 3)Well, I know how to use the arrays $_GET
["variable"], $_POST["variable"].Itīs just that they simply wonīt work in
that example. Perhaps Iīve included a couple of typos along the way, but I
doubt it. Do you think you could help me out?
Thanks a lot,
Joe,
> Joe,
> What book, what page? Unfortunately many authors make some assumptions
a> bout information that really should be included.
> It appears that you are trying to pass the values for:
> $age, $salary, $FirstName, $LastName, $Loan
> to this code that you included in your post.
> With your globals off have you implemented the $_GET, or $_POST ?
> Is this code not working for you and you are asking how to use the $_GET
a> nd $_POST variables?
> John
>
>> Iīve been having a lot of difficulty getting code to work. My php4
v> ersion
i> > s 4.1.2 and instead of using $variable (due to the fact that
r> > egister_globals is switched off by default in this and later versions)
I
h> > ave to use either $_GET["variable"]; or $_POST["variable"]; depending
o> n
t> > he method used. I keep coming across code in the book that simply
wonīt
w> > ork because the authors didnīt take that detail into account. I just
d> > onīt know how to go about it.The code snippet is the following:
> > <HTML>
<> > HEAD></HEAD>
<> > BODY>
<> > B>Namllu Credit Bank Loan Application Form</B>
<> > BR>
<> > BR>
<> > ?
$> > SalaryAllowance = $Salary/5;
$> > AgeAllowance = ($Age/10 - ($Age%10)/10)-1;
$> > LoanAllowance = $SalaryAllowance * $AgeAllowance;
e> > cho "Loan wanted:$Loan<BR>";
e> > cho "Loan amount we will allow:$LoanAllowance<BR><BR>";
i> > f ($Loan <= $LoanAllowance) echo "Yes, $FirstName $LastName, we are
d> > elighted to accept your application";
i> > f ($Loan > $LoanAllowance) echo "Sorry, $FirstName $LastName, we
cannot
a> > ccept your application at this time";
?> > >
<> > /BODY>
<> > /HTML>
> > Can anyone please help me? Does anyone know whether or not the authors
h> > ave already realized how difficult itīs been for readers to keep
trying
t> > o figure out how to get the examples to work?
> > Thanks in advance,
> > Joe
|
 |