Parse error:syntax error, unexpected ' "class_rect.php" ' solution ideas

Source: Internet
Author: User
Tags parse error
Parse error:syntax error, unexpected ' "class_rect.php"



<title>The perimeter and area of the graph calculator</title>




Auto Load
Requireonce "class_rect.php";
Requireonce "class_triangle.php";
Requireonce "class_circle.php";

function __autoload ($className) {
Include ("Class_". Ucfirst ($className). ". PHP ");
}
?>

The perimeter and area of the graph calculator



Rectangle | |
Triangle | |
Circular


Switch ($_request["action"]) {
Case ' 1 ':
$form =new form ("Rectangle", $_request, "test.php");
Echo $form;
Break

Case ' 2 ':
$form =new form ("Triangle", $_request, "test.php", "post", "_blank");
Echo $form;
Break

Case ' 3 ':
$form =new form ("Round", $_request, "test.php");
Echo $form;
Break

Default
echo "Please select a shape
";

}

if (Isset ($_request["Act"])) {
Switch ($_request["Act"]) {
Case ' 1 ':
$shape =new Rect ($_request);
Break

Case ' 2 ':
$shape =new Triangle ($_request);
Break

Case ' 3 ':
$shape =new Circle ($_request);
Break

}

echo "Area:". $shape->area (). "
";
echo "Perimeter is:". $shape->perimeter (). "
";
}
?>



------to solve the idea----------------------
References:



<title>The perimeter and area of the graph calculator</title>




Auto Load
Require_once "class_rect.php";
Require_once "class_triangle.php";
Require_once "class_circle.php";

function __autoload ($className) {
Include ("Class_". Ucfirst ($className). ". PHP ");
}
?>

The perimeter and area of the graph calculator



Rectangular
------to solve the idea----------------------

Triangle
------to solve the idea----------------------

Circular


Switch ($_request["action"]) {
Case ' 1 ':
$form =new form ("Rectangle", $_request, "test.php");
Echo $form;
Break

Case ' 2 ':
$form =new form ("Triangle", $_request, "test.php", "post", "_blank");
Echo $form;
Break

Case ' 3 ':
$form =new form ("Round", $_request, "test.php");
Echo $form;
Break

Default
echo "Please select a shape
";

}


if (Isset ($_request["Act"])) {
Switch ($_request["Act"]) {
Case ' 1 ':
$shape =new Rect ($_request);
Break

Case ' 2 ':
$shape =new Triangle ($_request);
Break

Case ' 3 ':
$shape =new Circle ($_request);
Break

}

echo "Area:". $shape->area (). "
";
echo "Perimeter is:". $shape->perimeter (). "
";
}
?>





The error here is to show that $_request["action" does not exist, without this index

You need to decide if it's empty.


$action = Isset ($_request["action"])? $_request["Action"]: ';
Switch ($action)
{
。。。。。。。。
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.