qoute form

Hi Good day,
I’m a web designer. I know html css and a little javascript and now I want to learn php.
my goal is to make “get a qoute” form for my website.

I want things to be calculated upon filling the form. here’s the code I come up with, no html structure yet. I just want to see if it works. but i didn’t

[php]
$page = 5;
$purpose = 4;
$hostDom = 2;
$qoute;

function total()
{
function MyPage()
{
global $page,$qoute;

if(page >= 5)
{
	$qoute = $qoute + 3000;
}		

}

function MyPurpose()
{
global $purpose,$qoute;

	if(purpose = 4)
		{
			$qoute = $qoute + 3500;
		}

}

function MyhostDom()
{
global $hostDom,$qoute;

	if(hostDom = 1)
		{
			$qoute = $qoute + 1000;
		}
		
	if else((hostDom = 2)
		{
			$qoute = $qoute + 3000;
		}

}

echo $qoute;

}

total();

[/php]

i just want to print out the total qoute.

please help.

Thanks!

  1. You should not use nested functions.

  2. The functions nested inside total() are never executed.

  3. In MyPurpose() and MyhostDom() you have some syntax errors. purpose should be $purpose and you should be using double equals $purpose == 4 (same thing in MyhostDom())

  4. In MyhostDom() if else is a syntax error. It should be else or else if

Let’s see if you can make any more progress after making these changes.

Sponsor our Newsletter | Privacy Policy | Terms of Service