T字符串错误PHP

时间:2016-02-24 18:57:30

标签: php

我是php的新手,正在完成任务。我几乎复制了与我们老师给我们的示例相同的格式(我刚刚更改了变量名称),但我得到了一个意外的' fnameempty' (T_STRING),期待']' 我不确定为什么会这样。你能帮忙吗?

这是我的代码:

if(isset($_POST['calculate])) {

   $errors =array();

  $fname = $_POST["firstname"];
  $fname = trim($fname);
  $fname = strtolower($fname);
  $fname = ucfirst($fname);
  $lname = $_POST["lastname"];
  $lname = trim($lname);
  $lname = strtolower($lname);
  $lname = ucfirst($lname);
  $hworked = $_POST["hoursworked"];
  $hwage = $_POST["hourlywage"];

//Validating empty elements

  if(empty($fname)) {
    $errors['fnameempty'] = "*";
  }

谢谢!

1 个答案:

答案 0 :(得分:1)

您已忘记public function generate(Requests\Generate $request) { //This grabs the values of all of the selected check boxes which happens to be the event id's $event_id = implode(",", $request->input('event_name')); //This attempts to query from the database based on the event id's that were selected. $event = \App\Events::where('event_id', $event_id)->get(); } 数组中的结束'

$_POST