Davecachia Posted August 14, 2008 Share Posted August 14, 2008 I am trying to read in my values from an HTML form into my PHP file. Someone on the board gave me this if statement to work with: if( isset( $_POST['process_form'] ) ) Now I assume 'process_form' must be the value of the submit button. I am not sure what the isset means. The submit button has the value 'process_form however, it is not running through my if statement. 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> <p>Impact of Training Form:</p> <p>Please enter your company name: </p> <form id="Survey" name="Survey" form action="survey.php"method="post" > <label>Company Name <input type="text" name="CompanyName" /> </label> <p><strong>Please select your industry type:</strong></p> <label>Industry Type <select name="IndustryType"> <option value="1">Select Industry..</option> <option value="2">Forestry, Mining, Oil, and Gas extraction</option> <option value="3">Finance and Insurance</option> <option value="4">Real estate, rental, and leasing ops </option> <option value="5">Business services </option> <option value="6">Education and health services</option> <option value="7">Information and cultural services </option> <option value="8">Labour intensive tertiary manufacturing </option> <option value="9">Primary product manufacturing </option> <option value="10">Secondary product manufacturing </option> <option value="11">Capital intensive tertiary manufacturing </option> <option value="14">Construction </option> <option value="15">Transportation, warehousing, wholesale </option> <option value="16">Communication and utilities </option> <option value="17">Retail trade and consumer services </option> <option value="18">None of the above </option> </select> </label> <p><strong>Please select your company size: </strong></p> <label> <input name="CompanySize" type="radio" value="1" /> Small (less than 50 employees) </label> <p> <label> <input name="CompanySize" type="radio" value="2" /> Medium (between 50 and 250 employees) </label> </p> <p> <label> <input name="CompanySize" type="radio" value="3" /> Large (greater than 250) </label> <br /> </p> <p align="left"><strong>Class Room Training </strong></p> <p align="left">If your organization participated in Class Room Training, please indicate so by clicking the appropriate radio button. </p> <label>Class Room Training</label> <input name="ClassRoomTraining" type="radio" value="1" /> <label>No Class Room Training</label> <input name="ClassRoomTraining" type="radio" value="2" /> <p><strong>Go to Question 2</strong></p> <p><strong> Your organization participates in Class Room Training. Please select those that apply: </strong></p> <label> <input type="checkbox" name="ClassRoomOrientation" value="1" /> Orientation for new Employees </label> <p> <label> <input type="checkbox" name="ClassRoomManagerialOrSupervisoryTraining" value="1" /> Managerial or Supervisory Training </label> </p> <p> <label> <input type="checkbox"name="ClassRoomApprenticeshipTraining" value="1"/> Apprenticeship Training</label> </p> <p> <label> <input type="checkbox" name="ClassRoomComputerHardware" value="1" /> Computer Hardware </label> </p> <p> <label> <input type="checkbox" name="ClassRoomComputerSoftware" value="1"/> Computer Software</label> </p> <p> <label> <input type="checkbox" name="ClassRoomOtherOffice" value="1" /> Other office and non-office equipment </label> </p> <p> <label> <input type="checkbox" name="ClassRoomGroupDecisionMaking" value="1" /> Group decision-making or problem solving </label> </p> <p> <label> <input type="checkbox" name="ClassRoomTeamBuilding" value="1" /> Team-building, leadership, communication</label> </p> <p> <label> <input type="checkbox" name="ClassRoomLiteracyOrNumeracy" value="1" /> Literacy or Numeracy </label> </p> <p><strong>Please estimate the workplaces total training expenditure (in Dollars)</strong></p> <p> <label>$ <input name="TotalTrainingExpenditure" type="text" id="TotalTrainingExpenditure" /> </label> </p> <p><strong>Which of the following are included in the estimate?</strong></p> <p> <label> <input type="checkbox" name="TrainersSalary" value="1" /> Trainers' Salaries </label> </p> <p> <label> <input type="checkbox" name="TraineesSalary" value="1" /> Trainees' Salaries </label> </p> <p> <label> <input type="checkbox" name="ContractsToVendors" value="1" /> Contracts to vendors </label> </p> <p> <label> <input type="checkbox" name="DirectTuition" value="1" /> Direct Tuition to schools or training institutions </label> </p> <p> <label> <input type="checkbox" name="TrainingMaterials" value="1" /> Training materials </label> </p> <p> <label> <input type="checkbox" name="TravelOrLivingCosts" value="1" /> Travel or living costs for trainees and trainers </label> </p> <p> <label> <input type="checkbox" name="Overhead" value="1" /> Overhead or Office costs for training </label> </p> <p> <label> <input type="checkbox" name="OtherTraining" value="1" /> Other training expenses </label> </p> <p align="left"><strong>Work Place Training</strong></p> <p align="left">If your organization participated in Work Place Training, please indicate so by clicking the appropriate radio button. </p> <label>Work Place Training </label> <input name="WorkPlaceTraining" type="radio" value="1" /> <label>No Work Place Training</label> <input name="WorkPlaceTraining" type="radio" value="2" /> <br> <p><strong>Your organization participates in Work Place Training. Please select those that apply:</strong></p> <br> <input type="checkbox" name="WorkPlaceOrientation" value="1" /> Orientation for new Employees </label> <p> <label> <input type="checkbox" name="WorkPlaceManagerialOrSupervisoryTraining" value="1" /> Managerial or Supervisory Training </label> </p> <p> <label> <input name="WorkPlaceApprenticeshipTraining" type="checkbox" value="1"/> Apprenticeship Training </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceComputerHardware" value="1" /> Computer Hardware </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceComputerSoftware" value="1"/> Computer Software </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceOtherOffice" value="1" /> Other Office and non-office equipment </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceGroupDecisionMaking" value="1" /> Group Decision Making or Problem Solving </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceTeamBuilding" value="1" /> Team-building, leadership, communication </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceLiteracyOrNumeracy" value="1" /> Literacy or Numeracy </label> </p> <p> <p> </p> <p><strong>Please estimate the amount of employees that have had workplace training between April of last year and March of this year: </strong></p> <p> <label> <input name="TotalAmountEmployees" type="text" id="TotalAmountEmployees" /> </label> </p> <input type="submit" value="process_form" /> <p> </p> <p> </p> <p></p> </form> <p> </p> </body> </html> and the PHP file.. <!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 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 } ?> 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 echo "TEST TEST TEST"; echo $CompanyName; echo $CompanySize; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/ Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 $_POST['process_form'] refers to an input field in your form named process_form, not with the value of 'process_form' <input type="submit" value="process_form" /> needs to be <input type="submit" name="process_form" value="Submit" /> Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616571 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 $_POST['process_form'] refers to an input field in your form named process_form, not with the value of 'process_form' <input type="submit" value="process_form" /> needs to be <input type="submit" name="process_form" value="Submit" /> Thanks for the help. I'll give it a whirl. Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616573 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 $_POST['process_form'] refers to an input field in your form named process_form, not with the value of 'process_form' <input type="submit" value="process_form" /> needs to be <input type="submit" name="process_form" value="Submit" /> Changed it - Still a no go. Seems as if it is not running the IF statement because in the bottom area in the code I output "TEST TEST TEST". I am guessing the variables are null (surprised it doesn't crash when a variable is null like in most programming languages?). Any other suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616575 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 Isset means "is this variable set" or "does this variable have a value". The problem is, as your code stands you do not have a variable named process_form, so add in a name attribute: <input type="submit" name="process_form" value="process_form" /> Note that your code is just asking "Does process_form have a value", so actually the value could be anything, i.e. <input type="submit" name="process_form" value="1" /> should work too. You could then change your main if statement to: if ($_POST['process_form'] == 1) { if you want more readable code. Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616578 Share on other sites More sharing options...
wildteen88 Posted August 14, 2008 Share Posted August 14, 2008 Isset means "is this variable set" or "does this variable have a value". isset only checks to see if a variable exists. It does not check to see if the variable has a value Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616579 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 Isset means "is this variable set" or "does this variable have a value". The problem is, as your code stands you do not have a variable named process_form, so add in a name attribute: <input type="submit" name="process_form" value="process_form" /> Note that your code is just asking "Does process_form have a value", so actually the value could be anything, i.e. <input type="submit" name="process_form" value="1" /> should work too. You could then change your main if statement to: if ($_POST['process_form'] == 1) { if you want more readable code. Rgds Parse error: syntax error, unexpected T_IS_EQUAL, expecting ',' or ')' in /home2/dcncs/public_html/survey.php on line 14 when you change the submit button to value = 1 Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616591 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 <input type="submit" name="process_form" value="Submit" /> else( isset( $_POST['process_form'] ) ) { still not running through. I think its because there is no action there. Between the ] and ) Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616612 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 OK, let's do it the way I would: Change your submit button back to this: <input type="submit" name="submit" value="Submit" /> Add this hidden field to the form: <input type="hidden" name="process_form" value="1"> Change your main If statement to: If ($_POST['process_form'] == 1) { This way the form processing is controlled by the hidden field. Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616615 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 OK, let's do it the way I would: Change your submit button back to this: <input type="submit" name="submit" value="Submit" /> Add this hidden field to the form: <input type="hidden" name="process_form" value="1"> Change your main If statement to: If ($_POST['process_form'] == 1) { This way the form processing is controlled by the hidden field. Rgds <?php echo "TEST TEST TEST"; echo $CompanyName; echo $CompanySize; ?> The statements work. The values of $CompanyName and $CompanySize are null so they are not being reported - so it is still not successfully going through the if statement. Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616620 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 I think you need a space after all your echos, i.e. Name: <?php echo$_POST["CompanyName"]; ?>.<br /> Becomes: Name: <?php echo $_POST["CompanyName"]; ?>.<br /> Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616625 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 No problem with the spaces there. The problem lies in the IF statement at the top as it is not reading in the variables. And because the if statements aren't being read, the variables are not being stored. Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616638 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 Also, the action type of your form is POST, so: $CompanyName = $_GET['CompanyName']; should be: $CompanyName = $_POST['CompanyName']; Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616641 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 You need a space before method, i.e. should be: <form id="Survey" name="Survey" form action="survey.php" method="post" > Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616647 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 Also, the action type of your form is POST, so: $CompanyName = $_GET['CompanyName']; should be: $CompanyName = $_POST['CompanyName']; Rgds I've changed it to both GET and both POST and still no results. Changed the HTML code as well to <form id="Survey" name="Survey" form action="survey.php" method="post" > Still no results. Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616655 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 I have modified the files and tried them on my server and it is now producing some output. There may be further issues with your code but hopefully this will give you some help: http://www.webref.eu/testing/survey.html <!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> <p>Impact of Training Form:</p> <p>Please enter your company name: </p> <form id="Survey" name="Survey" form action="survey.php" method="post" > <label>Company Name <input type="text" name="CompanyName" /> </label> <p><strong>Please select your industry type:</strong></p> <label>Industry Type <select name="IndustryType"> <option value="1">Select Industry..</option> <option value="2">Forestry, Mining, Oil, and Gas extraction</option> <option value="3">Finance and Insurance</option> <option value="4">Real estate, rental, and leasing ops </option> <option value="5">Business services </option> <option value="6">Education and health services</option> <option value="7">Information and cultural services </option> <option value="8">Labour intensive tertiary manufacturing </option> <option value="9">Primary product manufacturing </option> <option value="10">Secondary product manufacturing </option> <option value="11">Capital intensive tertiary manufacturing </option> <option value="14">Construction </option> <option value="15">Transportation, warehousing, wholesale </option> <option value="16">Communication and utilities </option> <option value="17">Retail trade and consumer services </option> <option value="18">None of the above </option> </select> </label> <p><strong>Please select your company size: </strong></p> <label> <input name="CompanySize" type="radio" value="1" /> Small (less than 50 employees) </label> <p> <label> <input name="CompanySize" type="radio" value="2" /> Medium (between 50 and 250 employees) </label> </p> <p> <label> <input name="CompanySize" type="radio" value="3" /> Large (greater than 250) </label> <br /> </p> <p align="left"><strong>Class Room Training </strong></p> <p align="left">If your organization participated in Class Room Training, please indicate so by clicking the appropriate radio button. </p> <label>Class Room Training</label> <input name="ClassRoomTraining" type="radio" value="1" /> <label>No Class Room Training</label> <input name="ClassRoomTraining" type="radio" value="2" /> <p><strong>Go to Question 2</strong></p> <p><strong> Your organization participates in Class Room Training. Please select those that apply: </strong></p> <label> <input type="checkbox" name="ClassRoomOrientation" value="1" /> Orientation for new Employees </label> <p> <label> <input type="checkbox" name="ClassRoomManagerialOrSupervisoryTraining" value="1" /> Managerial or Supervisory Training </label> </p> <p> <label> <input type="checkbox"name="ClassRoomApprenticeshipTraining" value="1"/> Apprenticeship Training</label> </p> <p> <label> <input type="checkbox" name="ClassRoomComputerHardware" value="1" /> Computer Hardware </label> </p> <p> <label> <input type="checkbox" name="ClassRoomComputerSoftware" value="1"/> Computer Software</label> </p> <p> <label> <input type="checkbox" name="ClassRoomOtherOffice" value="1" /> Other office and non-office equipment </label> </p> <p> <label> <input type="checkbox" name="ClassRoomGroupDecisionMaking" value="1" /> Group decision-making or problem solving </label> </p> <p> <label> <input type="checkbox" name="ClassRoomTeamBuilding" value="1" /> Team-building, leadership, communication</label> </p> <p> <label> <input type="checkbox" name="ClassRoomLiteracyOrNumeracy" value="1" /> Literacy or Numeracy </label> </p> <p><strong>Please estimate the workplaces total training expenditure (in Dollars)</strong></p> <p> <label>$ <input name="TotalTrainingExpenditure" type="text" id="TotalTrainingExpenditure" /> </label> </p> <p><strong>Which of the following are included in the estimate?</strong></p> <p> <label> <input type="checkbox" name="TrainersSalary" value="1" /> Trainers' Salaries </label> </p> <p> <label> <input type="checkbox" name="TraineesSalary" value="1" /> Trainees' Salaries </label> </p> <p> <label> <input type="checkbox" name="ContractsToVendors" value="1" /> Contracts to vendors </label> </p> <p> <label> <input type="checkbox" name="DirectTuition" value="1" /> Direct Tuition to schools or training institutions </label> </p> <p> <label> <input type="checkbox" name="TrainingMaterials" value="1" /> Training materials </label> </p> <p> <label> <input type="checkbox" name="TravelOrLivingCosts" value="1" /> Travel or living costs for trainees and trainers </label> </p> <p> <label> <input type="checkbox" name="Overhead" value="1" /> Overhead or Office costs for training </label> </p> <p> <label> <input type="checkbox" name="OtherTraining" value="1" /> Other training expenses </label> </p> <p align="left"><strong>Work Place Training</strong></p> <p align="left">If your organization participated in Work Place Training, please indicate so by clicking the appropriate radio button. </p> <label>Work Place Training </label> <input name="WorkPlaceTraining" type="radio" value="1" /> <label>No Work Place Training</label> <input name="WorkPlaceTraining" type="radio" value="2" /> <br> <p><strong>Your organization participates in Work Place Training. Please select those that apply:</strong></p> <br> <input type="checkbox" name="WorkPlaceOrientation" value="1" /> Orientation for new Employees </label> <p> <label> <input type="checkbox" name="WorkPlaceManagerialOrSupervisoryTraining" value="1" /> Managerial or Supervisory Training </label> </p> <p> <label> <input name="WorkPlaceApprenticeshipTraining" type="checkbox" value="1"/> Apprenticeship Training </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceComputerHardware" value="1" /> Computer Hardware </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceComputerSoftware" value="1"/> Computer Software </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceOtherOffice" value="1" /> Other Office and non-office equipment </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceGroupDecisionMaking" value="1" /> Group Decision Making or Problem Solving </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceTeamBuilding" value="1" /> Team-building, leadership, communication </label> </p> <p> <label> <input type="checkbox" name="WorkPlaceLiteracyOrNumeracy" value="1" /> Literacy or Numeracy </label> </p> <p> <p> </p> <p><strong>Please estimate the amount of employees that have had workplace training between April of last year and March of this year: </strong></p> <p> <label> <input name="TotalAmountEmployees" type="text" id="TotalAmountEmployees" /> </label> </p> <input type="submit" name="process_form" value="Submit the Form" /> <p> </p> <p> </p> <p></p> </form> <p> </p> </body> </html> http://www.webref.eu/testing/survey.php <!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 if( isset( $_POST['process_form'] ) ) { $CompanyName = $_POST['CompanyName']; $IndustryType = $_POST['IndustryType']; $CompanySize = $_POST['CompanySize']; $ClassRoomTraining = $_POST['ClassRoomTraining']; $ClassRoomOrientation = $_POST['ClassRoomOrientation']; $ClassRoomManagerialOrSupervisoryTraining = $_POST['ClassRoomManagerialOrSupervisoryTraining']; $ClassRoomApprenticeshipTraining = $_POST['ClassRoomApprenticeshipTraining']; $ClassroomComputerHardware = $_POST['ClassRoomComputerHardware']; $ClassroomComputerSoftware = $_POST['ClassRoomComputerSoftware']; $ClassroomOtherOffice = $_POST['ClassRoomOtherOffice']; $ClassroomGroupDecisionMaking = $_POST['ClassRoomGroupDecisionMaking']; $ClassroomTeamBuilding = $_POST['ClassRoomTeamBuilding']; $ClassroomLiteracyOrNumeracy = $_POST['ClassRoomLiteracyOrNumeracy']; $TotalTrainingExpenditure = $_POST['TotalTrainingExpenditure']; $TrainersSalary =$_POST['TrainersSalary']; /// Finished Here } ?> 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 echo "TEST TEST TEST"; echo $CompanyName; echo $CompanySize; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616706 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 Thanks I will give it a shot. Do you know what was wrong with it? And what further issues do you think are there? Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616714 Share on other sites More sharing options...
kenrbnsn Posted August 14, 2008 Share Posted August 14, 2008 At the top of the survey.php script, put <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; ?> This will dump all the values that are being returned to the script from the form. Ken Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616718 Share on other sites More sharing options...
webref.eu Posted August 14, 2008 Share Posted August 14, 2008 Do you know what was wrong with it? And what further issues do you think are there? I have stuck with the original technique of recognising that the form was posted, other than that the problems were as I detailed in earlier posts. Rgds Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616724 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 Do you know what was wrong with it? And what further issues do you think are there? I have stuck with the original technique of recognising that the form was posted, other than that the problems were as I detailed in earlier posts. Rgds It was working for a minute.. I changed something that should have no bearing on that (just changed the wording of something and its not working again.) <!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 if( isset( $_POST['process_form'] ) ) { $CompanyName = $_POST['CompanyName']; $IndustryType = $_POST['IndustryType']; $CompanySize = $_POST['CompanySize']; $ClassRoomTraining = $_POST['ClassRoomTraining']; $ClassRoomOrientation = $_POST['ClassRoomOrientation']; $ClassRoomManagerialOrSupervisoryTraining = $_POST['ClassRoomManagerialOrSupervisoryTraining']; $ClassRoomApprenticeshipTraining = $_POST['ClassRoomApprenticeshipTraining']; $ClassroomComputerHardware = $_POST['ClassRoomComputerHardware']; $ClassroomComputerSoftware = $_POST['ClassRoomComputerSoftware']; $ClassroomOtherOffice = $_POST['ClassRoomOtherOffice']; $ClassroomGroupDecisionMaking = $_POST['ClassRoomGroupDecisionMaking']; $ClassroomTeamBuilding = $_POST['ClassRoomTeamBuilding']; $ClassroomLiteracyOrNumeracy = $_POST['ClassRoomLiteracyOrNumeracy']; $TotalTrainingExpenditure = $_POST['TotalTrainingExpenditure']; $TrainersSalary =$_POST['TrainersSalary']; /// Finished Here } ?> 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 /> Total Amount of Employees: <?php echo $_POST["TotalAmountEmployees"]; ?>.<br /> <?php echo $CompanyName; echo $CompanySize; echo $IndustryType; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616766 Share on other sites More sharing options...
Davecachia Posted August 14, 2008 Author Share Posted August 14, 2008 It doesn't like this: <?php echo $CompanyName; echo $CompanySize; echo $IndustryType; ?> It will work with JUST company name, but if I put the other two in, it will not display Company name or any of them for that matter Quote Link to comment https://forums.phpfreaks.com/topic/119678-help-with-if-statement/#findComment-616768 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.