Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'syntax error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. I have two tables: -players -registrations Each Registrations record can have many Players associated with it. My registration/create action gives me a syntax error: syntax error, unexpected '$registration' (T_VARIABLE)Can someone help me see what I'm doing wrong to make this work? It's one of the biggest pieces of the puzzle I need to work locally before I can see if it works online. I created a controller named RegistrationController.php <?php namespace backend\controllers; use Yii; use backend\models\Registrations; use backend\models\Players; use backend\models\search\RegistrationsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\helpers\Json; use yii\helpers\ArrayHelper; use yii\base\Exception; /** * RegistrationController implements the CRUD actions for registration and players models. */ class RegistrationController extends Controller { public function actionCreate() { $registration = new Registrations(); $players = []; for ($i = 0; $i < 5; $i++) { $players[] = new Players(); } if ($registration->load(Yii::$app->request->post()) { $registration->save(); } if (Model::loadMultiple($players, Yii::$app->request->post()) { foreach ($players as $player) { $player->regsitrationID = $registration->ID; $player->save(); } } return $this->render('create',[ 'registration'=>$registration, 'players' => $players, ]); } } My create.php is the standard and rendersPartial _form.php (which is below): <?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\web\View; use backend\models\registration; use backend\models\players; use backend\models\registrations; /* @var $this yii\web\View */ /* @var $model backend\models\registration */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'user-form', 'enableAjaxValidation'=>false, )); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <div class="row"> <?= $form->field($registration, 'transactionID')->hiddenInput(['value'=>'2'])->label(false) ?> <?= $form->field($registration, 'divisionLevelID')->dropDownList($model->DivisionLevelAssignmentList, [ 'prompt' => 'Please Choose One' ]);?> <?= $form->field($registration, 'field')->dropDownList($model->FieldsList, [ 'prompt' => 'Please Choose One' ]);?> <?= $form->field($registration, 'net')->textInput() ?> <?= $form->field($registration, 'team')->textInput() ?> <?= $form->field($registration, 'notes')->textarea(['rows' => 6]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 1 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 2 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 3 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// <h2>Player 4 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <?php $this->endWidget(); ?> </div><!-- form -->
×
×
  • Create New...