Jump to content

Basic Syntax Errors


Davecachia

Recommended Posts

Where is the code?

 

 

The first part where I am just forwarding the info from the HTML form was just a learning experience.. I can probably get rid of that later. I need to read in the data from my HTML form --> Send to PHP file to be validated. If Validated, given a score.

Once score is determined.. Store the information in a database, then analyze for the user to see where they lost points.

 

Right now I am at the validation stage. I need to read the values into variables.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Survey</title>
</head>

<body>
<?php>
echo Impact of Training Form:
?>

// READ IN DATA FROM HTML FORM
<php>
Name: <?php echo$_POST["CompanyName"]; ?>.<br />
Industry Type: <?php echo$_POST["IndustryType"]; ?>.<br />
Company Size: <?php echo$_POST["CompanySize"]; ?>.<br />
ClassRoom Training: <?php echo$_POST["ClassRoomTraining"]; ?>.<br />
<br>
ClassRoom Options
Orientation: <?php echo$_POST["ClassRoomOrientation"]; ?>.<br />
Managerial or Supervisory Training: <?php echo$_POST["ClassRoomManagerialOrSupervisoryTraining"]; ?>.<br />
Apprenticeship Training: <?php echo$_POST["ClassRoomApprenticeshipTraining"]; ?>.<br />
Computer Hardware Training: <?php echo$_POST["ClassRoomComputerHardware"]; ?>.<br />
Computer Software Training: <?php echo$_POST["ClassRoomComputerSoftware"]; ?>.<br />
Other office and non office equipment: <?php echo$_POST["ClassRoomOtherOffice"]; ?>.<br />
Classroom Decision and Problem Solving: <?php echo$_POST["ClassRoomGroupDecisionMaking"]; ?>.<br />
Classroom Team Building: <?php echo$_POST["ClassRoomTeamBuilding"]; ?>.<br />
Classroom Literacy or Numeracy: <?php echo$_POST["ClassRoomLiteracyOrNumeracy"]; ?>.<br />
<br>
Total Training Expenditure: <?php echo$_POST["TotalTrainingExpenditure"]; ?>.<br />
Trainers Salary: <?php echo$_POST["TrainersSalary"]; ?>.<br />
Trainees Salary: <?php echo$_POST["TraineesSalary"]; ?>.<br />
Vendor Contracts: <?php echo$_POST["ContractsToVendors"]; ?>.<br />
Direct Tuition: <?php echo$_POST["DirectTuition"]; ?>.<br />
Training Materials: <?php echo$_POST["TrainingMaterials"]; ?>.<br />
Travel or Living expenses: <?php echo$_POST["TravelOrLivingCosts"]; ?>.<br />
Overhead: <?php echo$_POST["Overhead"]; ?>.<br />
Other: <?php echo$_POST["Other"]; ?>.<br />
<br>
Work Place Orientation: <?php echo$_POST["WorkPlaceOrientation"]; ?>.<br />
Work Place Managerial or Supervisory: <?php echo$_POST["WorkPlaceManagerialOrSupervisoryTraining"]; ?>.<br />
Work Place Apprenticeship Training: <?php echo$_POST["WorkPlaceApprenticeshipTraining"]; ?>.<br />
Work Place Computer Hardware: <?php echo$_POST["WorkPlaceComputerHardware"]; ?>.<br />
Work Place Computer Software: <?php echo$_POST["WorkPlaceComputerSoftware"]; ?>.<br />
Work Place Other Office: <?php echo$_POST["WorkPlaceOtherOffice"]; ?>.<br />
Work Place Group Decision Making: <?php echo$_POST["WorkPlaceGroupDecisionMaking"]; ?>.<br />
Work Place Team Building: <?php echo$_POST["WorkPlaceTeamBuilding"]; ?>.<br />
Work Place Literacy and Numeracy: <?php echo$_POST["WorkPlaceLiteracyOrNumeracy"]; ?>.<br />
<br>
Total Amount of Employees: <?php echo$_POST["TotalAmountEmployees"]; ?>.<br />
?>

<php>
if( isset( $_POST['process_form'] ) )
{
   $CompanyName = $_GET['CompanyName'];
   $IndustryType = $_GET['IndustryType'];
   $CompanySize = $_GET['CompanySize'];
   $ClassRoomTraining = $_GET['ClassRoomTraining'];
   $ClassRoomOrientation = $_GET['ClassRoomOrientation'];
   $ClassRoomManagerialOrSupervisoryTraining = $_GET['ClassRoomManagerialOrSupervisoryTraining'];
   $ClassRoomApprenticeshipTraining = $_GET['ClassRoomApprenticeshipTraining'];
   $ClassroomComputerHardware = $_GET['ClassRoomComputerHardware'];
   $ClassroomComputerSoftware = $_GET['ClassRoomComputerSoftware'];
   $ClassroomOtherOffice = $_GET['ClassRoomotherOffice'];
   $ClassroomGroupDecisionMaking = $_GET['ClassRoomGroupDecisionMaking'];
   $ClassroomTeamBuilding = $_GET['ClassRoomTeamBuilding'];
   $ClassroomLiteracyOrNumeracy = $_GET['ClassRoomLiteracyOrNumeracy'];
   $TotalTrainingExpenditure = $_GET['TotalTrainingExpenditure'];
   $TrainersSalary =$_GET['TrainersSalary'];
   /// Finished Here
   
   
   $Class
}

echo Companyname;
?>
</body>


</html>

Link to comment
Share on other sites

Well this is wrong

<body>
<?php>
echo Impact of Training Form:
?>

it should be

<body>
<?php>
echo 'Impact of Training Form:';
?>

 

All strings must be within quotes.

 

OK. What about the first block of code where I am POSTing values. Do they all need ' ; ' at the end of each line?

Link to comment
Share on other sites

and change this:

 

<?php>

 

to this:

 

<?php

 

Thank you!

 

Should I use put

<?php

 

 

 

 

?>

Only once in the page? Or Should I use it multiple times for different blocks?

 

@Wildteen

I am familiar with C++ and VB.NET.

First time doing web scripts.

 

I know what strings are :) just unfamiliar with the language.

 

Link to comment
Share on other sites

Damnit.. I broke it again.

Here's the code

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Survey</title>
</head>

<body>
<?php
echo 'Impact of Training Form:';
?>

// READ IN DATA FROM HTML FORM

Name: <?php echo$_POST["CompanyName"]; ?>.<br />
Industry Type: <?php echo$_POST["IndustryType"]; ?>.<br />
Company Size: <?php echo$_POST["CompanySize"]; ?>.<br />
ClassRoom Training: <?php echo$_POST["ClassRoomTraining"]; ?>.<br />
<br>
ClassRoom Options
Orientation: <?php echo$_POST["ClassRoomOrientation"]; ?>.<br />
Managerial or Supervisory Training: <?php echo$_POST["ClassRoomManagerialOrSupervisoryTraining"]; ?>.<br />
Apprenticeship Training: <?php echo$_POST["ClassRoomApprenticeshipTraining"]; ?>.<br />
Computer Hardware Training: <?php echo$_POST["ClassRoomComputerHardware"]; ?>.<br />
Computer Software Training: <?php echo$_POST["ClassRoomComputerSoftware"]; ?>.<br />
Other office and non office equipment: <?php echo$_POST["ClassRoomOtherOffice"]; ?>.<br />
Classroom Decision and Problem Solving: <?php echo$_POST["ClassRoomGroupDecisionMaking"]; ?>.<br />
Classroom Team Building: <?php echo$_POST["ClassRoomTeamBuilding"]; ?>.<br />
Classroom Literacy or Numeracy: <?php echo$_POST["ClassRoomLiteracyOrNumeracy"]; ?>.<br />
<br>
Total Training Expenditure: <?php echo$_POST["TotalTrainingExpenditure"]; ?>.<br />
Trainers Salary: <?php echo$_POST["TrainersSalary"]; ?>.<br />
Trainees Salary: <?php echo$_POST["TraineesSalary"]; ?>.<br />
Vendor Contracts: <?php echo$_POST["ContractsToVendors"]; ?>.<br />
Direct Tuition: <?php echo$_POST["DirectTuition"]; ?>.<br />
Training Materials: <?php echo$_POST["TrainingMaterials"]; ?>.<br />
Travel or Living expenses: <?php echo$_POST["TravelOrLivingCosts"]; ?>.<br />
Overhead: <?php echo$_POST["Overhead"]; ?>.<br />
Other: <?php echo$_POST["Other"]; ?>.<br />
<br>
Work Place Orientation: <?php echo$_POST["WorkPlaceOrientation"]; ?>.<br />
Work Place Managerial or Supervisory: <?php echo$_POST["WorkPlaceManagerialOrSupervisoryTraining"]; ?>.<br />
Work Place Apprenticeship Training: <?php echo$_POST["WorkPlaceApprenticeshipTraining"]; ?>.<br />
Work Place Computer Hardware: <?php echo$_POST["WorkPlaceComputerHardware"]; ?>.<br />
Work Place Computer Software: <?php echo$_POST["WorkPlaceComputerSoftware"]; ?>.<br />
Work Place Other Office: <?php echo$_POST["WorkPlaceOtherOffice"]; ?>.<br />
Work Place Group Decision Making: <?php echo$_POST["WorkPlaceGroupDecisionMaking"]; ?>.<br />
Work Place Team Building: <?php echo$_POST["WorkPlaceTeamBuilding"]; ?>.<br />
Work Place Literacy and Numeracy: <?php echo$_POST["WorkPlaceLiteracyOrNumeracy"]; ?>.<br />
<br>
Total Amount of Employees: <?php echo$_POST["TotalAmountEmployees"]; ?>.<br />


<?php
if( isset( $_POST['process_form'] ) )
{
   $CompanyName = $_GET['CompanyName'];
   $IndustryType = $_GET['IndustryType'];
   $CompanySize = $_GET['CompanySize'];
   $ClassRoomTraining = $_GET['ClassRoomTraining'];
   $ClassRoomOrientation = $_GET['ClassRoomOrientation'];
   $ClassRoomManagerialOrSupervisoryTraining = $_GET['ClassRoomManagerialOrSupervisoryTraining'];
   $ClassRoomApprenticeshipTraining = $_GET['ClassRoomApprenticeshipTraining'];
   $ClassroomComputerHardware = $_GET['ClassRoomComputerHardware'];
   $ClassroomComputerSoftware = $_GET['ClassRoomComputerSoftware'];
   $ClassroomOtherOffice = $_GET['ClassRoomotherOffice'];
   $ClassroomGroupDecisionMaking = $_GET['ClassRoomGroupDecisionMaking'];
   $ClassroomTeamBuilding = $_GET['ClassRoomTeamBuilding'];
   $ClassroomLiteracyOrNumeracy = $_GET['ClassRoomLiteracyOrNumeracy'];
   $TotalTrainingExpenditure = $_GET['TotalTrainingExpenditure'];
   $TrainersSalary =$_GET['TrainersSalary'];
   /// Finished Here
   
   
   $Class
}
echo CompanyName; // TEST TO SEE IF IT WORKS
?>
</body>


</html>

Link to comment
Share on other sites

Is companyName a variable? If so variables should always start with a dollar sign, eg

 

echo $CompanyName;

 

Again I urge you to read the basics. Getting to know the basics will help you much more than having to keep asking us.

 

 

Yes that is a variable name. I am testing to see if the IF statement has stored the variable.

I learn much better this way, i've gone through the W3Schools stuff but making mistakes and learning from them helps me the most I think.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.