Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

DW 8 and Partial PHP

Explorer ,
May 16, 2006 May 16, 2006
I've setup Apache, PHP 4.3.1, MySQL, and DW 8 on local OS X Panther machine. Everything seemed to work fine:


<?php echo 'Welcome to PHP!';
?> ok

<?php $today = date('F jS, Y');
echo "Today's date is $today";
?> ok

however when I try:

<?php
$taxDue = calculateTax(80, 8);
echo $taxDue; //displays 6.4
?>

I get:

Fatal error: Call to undefined function: calculatetax() in /Users/myComputer/Sites/dw_php/phpFunctionTest.php on line 12

Think this must be a php.ini config problem but I can't locate it. Any help greatly appreciated ...


scootdown



TOPICS
Server side applications
337
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , May 16, 2006 May 16, 2006
Ok, forgot to define the function:

<?php
function calculateTax($total, $taxRate) {
$tax = $total * $taxRate/100;
return $tax;
}

$taxDue = calculateTax(80, 8);
echo $taxDue; //displays 6.4
?>

Thanks Joe & Tom!

Scootdown
Translate
LEGEND ,
May 16, 2006 May 16, 2006
On Tue 16 May 2006 05:45:35p, scootdown wrote in
macromedia.dreamweaver.appdev:

> I've setup Apache, PHP 4.3.1, MySQL, and DW 8 on local OS X Panther
> machine. Everything seemed to work fine:
>
>
> <?php echo 'Welcome to PHP!';
> ?> ok
>
> <?php $today = date('F jS, Y');
> echo "Today's date is $today";
> ?> ok
>
> however when I try:
>
> <?php
> $taxDue = calculateTax(80, 8);
> echo $taxDue; //displays 6.4
> ?>
>
> I get:
>
> Fatal error: Call to undefined function: calculatetax() in
> /Users/myComputer/Sites/dw_php/phpFunctionTest.php on line 12
>
> Think this must be a php.ini config problem but I can't locate it.
> Any help greatly appreciated ...

Did you define calculateTax()? Also, user-defined function names in PHP
are case sensitive:

http://www.php.net/manual/en/language.functions.php#functions.user-defined
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 16, 2006 May 16, 2006
> Fatal error: Call to undefined function: calculatetax() in
> /Users/myComputer/Sites/dw_php/phpFunctionTest.php on line 12
>
> Think this must be a php.ini config problem but I can't locate it. Any
> help
> greatly appreciated ...

Did you define a calculateTax() function on the page?


--
--
Tom Muck
co-author Dreamweaver MX 2004: The Complete Reference
http://www.tom-muck.com/

Cartweaver Development Team
http://www.cartweaver.com

Extending Knowledge Daily
http://www.communitymx.com/


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 16, 2006 May 16, 2006
LATEST
Ok, forgot to define the function:

<?php
function calculateTax($total, $taxRate) {
$tax = $total * $taxRate/100;
return $tax;
}

$taxDue = calculateTax(80, 8);
echo $taxDue; //displays 6.4
?>

Thanks Joe & Tom!

Scootdown
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines