Vous êtes sur la page 1sur 7

pdfcrowd.com open in browser PRO version Are you a developer?

Try out the HTML to PDF API


What are y ou looking for? Search
PHPEveryDay
PHP and Web Development Tutorial

CodeIgniter - Form: CodeIgniter HTML Style
1. Create a Website
2. PHP Hosting
3. Learn PHP
4. Database Design
5. Web Programming
6. Visual Basic Programming
7. Business Web Design
8. PHP Programmer

CodeIgniter Form Step By Step Tutorial - Part 1 0: We hav e learn create form using HTML at
prev ious post. CodeIgniter hav e library for other HTML tag. For use it, we must call HTML
helper.
First, load HTML helper at controller. You can see at line 1 7 :
01 <?
02 class Books extends Controller{
03
04 function Books(){
05 parent::Controller();
06 }
07
08 function main(){
09 $this->load->model('books_model');
10 $data = $this->books_model->general();
11
12 $this->load->view('books_main',$data);
13 }
14
15 function input(){
16 $this->load->helper('form');
17 $this->load->helper('html');
Database Tutorial
Lear n PHP My SQL
Lear n PHP ADOdb
Lear n PHP Dat a Object /PDO
Lear n PHP XML
Lear n PHP SimpleXML
Security Tutorial
Lear n PHP Secur it y
Lear n HTTP Aut hent icat ion
Lear n PHPSecur eSit e
Framework Tutorial
Lear n CodeIgnit er
Lear n Joomla
Lear n Smar t y
Lear n Zend Fr amewor k
Template Tutorial
Lear n Joomla Templat e
Lear n Wor dPr ess Templat e
API Tutorial
Lear n Facebook
JS Framework Tutorial
Lear n MooTools
Lear n JQuer y
Lear n JQuer y UI
AJAX Tutorial
Lear n AJAX in 1 0 Minut es
Lear n AJAX Client Side
Lear n AJAX PHP
Lear n AJAX Remot e Ser v er
Lear n AJAX Repet it iv e
Lear n AJAX My SQL
Lear n AJAX Gr id
Web Services Tutorial
Lear n Web Ser v ices NuSOAP
Lear n Web Ser v ices WSDL
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Next, we try to implement HTML CodeIgniter sty le. Update y our books_input.php
17 $this->load->helper('html');
18 $this->load->model('books_model');
19 $data = $this->books_model->general();
20
21 $this->load->view('books_input',$data);
22 }
23 }
24 ?>
01 <html>
02 <head>
03 <link rel="stylesheet" type="text/css"
04 href="<?php echo "$base/$css"?>">
05 </head>
06 <body>
07 <div id="header">
08 <? $this->load->view('books_header'); ?>
09 </div>
10 <div id="menu">
11 <? $this->load->view('books_menu'); ?>
12 </div>
13 <? echo heading($forminput,3) ?>
14 <? echo form_open('books/input'); ?>
15 <? echo $title .' : '.
16 form_input($ftitle).br(); ?>
17 <? echo $author .' : '.
18 form_input($fauthor).br(); ?>
19 <? echo $publisher .' : '.
20 form_input($fpublisher).br(); ?>
21 <? echo $year .' : '.
22 form_dropdown('year',$years).br(); ?>
23 <? echo $available .' : '.
24 form_checkbox($favailable).br(); ?>
25 <? echo $summary .' : '.
26 form_textarea($fsummary).br(); ?>
27 <? echo form_submit('mysubmit','Submit!'); ?>
28 <? echo form_close(); ?>
29
30 <div id="footer">
31 <? $this->load->view('books_footer'); ?>
32 </div>
33
34 </body>
35 </html>
Lear n Web Ser v ices WSDL
Lear n Web Ser v ices WSDL Ar r ay
Lear n Web Ser v ices . NET Gr id
Lear n Web Ser v ices WDDX
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
For example, line 1 3, heading($forminput,3) to change <h3>$forminput</h3>. Line 1 6, br() to change </br>.
For complete this practice, add definition of $forminput at model (line 28 at following code):
01 <?
02 class books_model extends Model{
03
04 function books_model(){
05 parent::Model();
06 $this->load->helper('url');
07 }
08
09 function general(){
10 $this->load->library('MyMenu');
11 $menu = new MyMenu;
12 $data['base'] = $this->config->item('base_url');
13 $data['css'] = $this->config->item('css');
14 $data['menu'] = $menu->show_menu();
15 $data['webtitle'] = 'Book Collection';
16 $data['websubtitle']= 'We collect all title of
17 books on the world';
18 $data['webfooter'] = ' copyright by step
19 by step php tutorial';
20
21 $data['title'] = 'Title';
22 $data['author'] = 'Author';
23 $data['publisher'] = 'Publisher';
24 $data['year'] = 'Year';
25 $data['years'] = array('2007'=>'2007',
26 '2008'=>'2008',
27 '2009'=>'2009');
28 $data['available'] = 'Available';
29 $data['summary'] = 'Summary';
30 $data['forminput'] = 'Form Input';
31
32 $data['ftitle'] = array('name'=>'title',
33 'size'=>30
34 );
35 $data['fauthor'] = array('name'=>'author',
36 'size'=>30
37 );
38 $data['fpublisher'] = array('name'=>'publisher',
39 'size'=>30
40 );
41
42 $data['favailable'] = array('name'=>'available',
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
Series this article:
CodeIgniter - Form: Creating Skeleton
CodeIgniter - Form: File Structure
CodeIgniter - Form: Creating Lay out Code
CodeIgniter - Form: Creating Menu Library
CodeIgniter - Form: Putting Text at Header and Footer
CodeIgniter - Form: Centralizing $data
CodeIgniter - Form: Adding CSS
CodeIgniter - Form: Creating Form HTML
CodeIgniter - Form: Creating Beautiful Form Code
CodeIgniter - Form: CodeIgniter HTML Style
CodeIgniter - Form: Preparing Table at Database
CodeIgniter - Form: Creating Insert Data
CodeIgniter - Form: Creating List Data Use Table Library
CodeIgniter - Form: Creating Table List Without Table Library
CodeIgniter - Form: Using URL Helper
CodeIgniter - Form: Showing Single Data for Form Edit
CodeIgniter - Form: Something Happen With Form Parameters
CodeIgniter - Form: Updating Data
CodeIgniter - Form: Deleting Data
Tag: CodeIgni ter, framework, MVC, HTML Category: PHP Framework Post : February 24th 2008 Read: 91,966
Table of Content
Learn CodeIgniter Framework Tutorial
Learn CodeIgniter Basic
CI Framework
CI Installation
42 $data['favailable'] = array('name'=>'available',
43 'value'=>'yes',
44 'checked'=>TRUE
45 );
46 $data['fsummary'] = array('name'=>'summary',
47 'rows'=>5,
48 'cols'=>30
49 );
50 return $data;
51 }
52 }
53 ?>
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
CI MVC
CI Parameter
CI GET
CI Database Config
CI Database
CI Show All Data
CI Show a Data
CI GET Data
Learn CodeIgniter Form
CI Skeleton
CI Structure
CI Lay out
CI Menu
CI Text
CI Centralizing
CI CSS
CI HTML
CI Form Code
CI HTML Style
CI Table
CI Insert Data
CI Table Library
CI Table List
CI URL Helper
CI Single Data
CI Form Parameters
CI Updating Data
CI Deleting Data
adv ertisements
PHP code generator
xlinesoft.com/phprunner
Generate PHP code for any local or remote database.
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API
AROUND THE WEB
Home 1 comment
ALSO ON PHP EVERYDAY
New Jersey Man
Hits Record
Jackpot at Borgata
Casino
The Borgata
Controversial
"Skinny Pill"
Sweeps the Nation
Healthy LifeStyle
Little Known Way to
Pay Off Mortgage
Lifestyle Journal
Please Dont Retire
At 62. Heres Why.
The Motley Fool
0 Comments PHP Everyday
Sort by Best Share
Start the discussion
Be the first to comment.
Subscribe Add Disqus to your site
pdfcrowd.com open in browser PRO version Are you a developer? Try out the HTML to PDF API

PHPEv ery Day 201 0