Syntax Help
Posted: Mon Sep 11, 2006 2:35 am
Ok here's the gist. I am new at progamming so any help would be appreciated. I am creating a form for a user so they can have their clients get an estimate before they order their product. I wanted to use my newly, and I mean newly accquire "skills" in PHP to create this. What happens: they select what package they want, they then click submit and it produces a total on screen.
I did a search and found some php scripts for calculators and this is what I came up with. The main problem the php parsing is having is my if then statements. Here is the code:
There errors that are produced are:
I got the code idea from a forum earlier: here is the link:
http://www.lonford.co.uk/random/thispage.php
Tell me what I am doing wrong....
Also he has the following:
[qoute]
<?php
$foo = $_POST['foo'];
$bar = $_POST['bar'];
if ($foo AND $bar)
{
$answer = $foo + $bar;
}
?>
[/qoute]
the if ($foo AND $bar) part - does that have to be in there for this to work. Also my client is going to have multpile options that don't have to be chosen...so it is a bit more complex. Any help would be greatly appreciated.
I did a search and found some php scripts for calculators and this is what I came up with. The main problem the php parsing is having is my if then statements. Here is the code:
Code: Select all
<?
$package = $_REQUEST['package'];
$basic = 1500;
$professionalLite = 2300;
$premiumProfessional = 3500;
if ($package == basic) {
$answer = $basic;
}
if ($package == professionalLite) {
$answer = $professionalLite;
}
if ($package == premiumProfessional) {
$asnwer = $premiumProfessional;
}
?>Code: Select all
Notice: Use of undefined constant basic - assumed 'basic' in D:\users\something.com\contact\web_orders.php on line 83
Notice: Use of undefined constant professionalLite - assumed 'professionalLite' in D:\users\something.com\contact\web_orders.php on line 87
Notice: Use of undefined constant premiumProfessional - assumed 'premiumProfessional' in D:\users\something.com\contact\web_orders.php on line 91http://www.lonford.co.uk/random/thispage.php
Tell me what I am doing wrong....
Also he has the following:
[qoute]
<?php
$foo = $_POST['foo'];
$bar = $_POST['bar'];
if ($foo AND $bar)
{
$answer = $foo + $bar;
}
?>
[/qoute]
the if ($foo AND $bar) part - does that have to be in there for this to work. Also my client is going to have multpile options that don't have to be chosen...so it is a bit more complex. Any help would be greatly appreciated.