Davecachia Posted August 14, 2008 Share Posted August 14, 2008 Hey all. My first time coding in PHP and I have some basic syntax errors. If you could have a look at: http://www.dcncs.net/survey.html which forwards the information to http://www.dcncs.net/survey.php Also - My if someone could take a look at the IF statement near the bottom of the survey php file that would be great. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/ Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 Internal Error 500 now when I test it :S Help please! Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616503 Share on other sites More sharing options...
The Little Guy Posted August 14, 2008 Share Posted August 14, 2008 Where is the code? Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616504 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616506 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616509 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616512 Share on other sites More sharing options...
The Little Guy Posted August 14, 2008 Share Posted August 14, 2008 and change this: <?php> to this: <?php Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616514 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 No, you dont wrap quotes around variables, only strings. You do know what a string is? I suggest you read the basics of PHP before you continue. Without the basics you're not going to get very far. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616518 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616521 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616527 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616532 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/119669-basic-syntax-errors/#findComment-616546 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.