Autor wpisu: Spawnm, dodany: 27.03.2009 14:00, tagi: php
W artykule wykorzystam jedną z popularniejszych baz czyli MySQL.
This time i want to give you simple example about how to create multipage (wiazard) form using great Symfony 1.2 form framework. It would be simple 3 steps registeration form with validation after each step. In this example i’m using propel but it would also work great wiht Doctrine. Lets start!
First, we need to start a new project, create frontend application and multiPageForm module (from the command line prompt):
symfony generate:project multipageFormApp
symfony generate:app frontend
symfony generate:module frontend multiPageForm
Then, after setting database connection with:
symfony configure:database “mysql:host=localost;dbname=your_db” user pass
put the follwing code into the schema.yml:
propel:
user:
id:
username: { type: varchar(30), index: unique, required: true }
password: { type: varchar(30), required: true }
account_type: { type: smallint, default: 0, required: true}
email: { type: varchar(30), required: true }
name: { type: varchar(30), required: true}
surname: { type: varchar(30), required: true}
address: varchar(50)
city: varchar(30)
zipcode: varchar(10)
country: varchar(30)
phone_number: {type: varchar(30), required: true}
is_confirmed: { type: boolean, default: 0 }
last_login: timestamp
updated_at:
created_at:
Then call: