Jump to content

[SOLVED] simple error


stig39

Recommended Posts

Hi All,

 

I am recieving the following error on line 14:

 

unexpected T_ELSE

 

<?
if($submit_1) {

$b=$_POST['input_1_10'];
$b1=$_POST['input_1_12'];
$b2=$_POST['input_1_14'];
$b3=$_POST['input_1_16'];
$b4=$_POST['input_1_18'];
$b5=$_POST['input_1_20'];
$b6=$_POST['input_1_22'];
$b7=$_POST['input_1_24'];

if ($b=="" and $b1=="" and $b2=="" and $b3=="" and $b4=="" and $b5=="" and $b6=="" and $b7=="")  {echo 
else 
   $a = array($b, $b1, $b2, $b3, $b4, $b5, $b6, $b7);
  include ("ajstatistics.php");
$standard_deviation = standard_deviation_population ($a);
$proc=$a[0] / $standard_deviation * 100;
$sk="100";
?>

Link to comment
https://forums.phpfreaks.com/topic/49368-solved-simple-error/
Share on other sites

<?php

if($submit_1) {


$b=$_POST['input_1_10'];
$b1=$_POST['input_1_12'];
$b2=$_POST['input_1_14'];
$b3=$_POST['input_1_16'];
$b4=$_POST['input_1_18'];
$b5=$_POST['input_1_20'];
$b6=$_POST['input_1_22'];
$b7=$_POST['input_1_24'];

if ($b=="" and $b1=="" and $b2=="" and $b3=="" and $b4=="" and $b5=="" and $b6=="" and $b7=="")  {

echo "what?"; //You didn't put anything to echo???

} else { //Forgot your curly brackets
   $a = array($b, $b1, $b2, $b3, $b4, $b5, $b6, $b7);
  include ("ajstatistics.php");
$standard_deviation = standard_deviation_population ($a);
$proc=$a[0] / $standard_deviation * 100;
$sk="100";

} //You need to close both IF statements
}

?>

 

I commented throughout your code to show you what I corrected. My code is untested, but see if it works now.

Link to comment
https://forums.phpfreaks.com/topic/49368-solved-simple-error/#findComment-241903
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.