You are on page 1of 50

NOTA PHP

Menggunakan Adobe Dreamweaver

DISEDIAKAN OLEH

Arif Wahab

INTRODUCTION What is PHP PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. Simple answer, but what does that mean? An example: An introductory example <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html> Notice how this is different from a script written in other languages like Perl or C -instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. If you were to have a script similar to the above on your server, the client would receive the results of running that script, with no way of determining what the underlying code may be. You can even configure your web server to process all your HTML files with PHP, and then there's really no way that users can tell what you have up your sleeve. The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer. Don't be afraid reading the long list of PHP's features. You can jump in, in a short time, and start writing simple scripts in a few hours. Although PHP's development is focused on server-side scripting, you can do much more with it. Read on, and see more in the What can PHP do? section, or go right to the introductory tutorial if you are only interested in web programming.

What can PHP do Anything. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more. There are three main areas where PHP scripts are used. • Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a webserver and a web browser. You need to run the webserver, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming. See the installation instructions section for more information.

• Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about Command line usage of PHP for more information. • Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit its own website. PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor. So with PHP, you have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is implemented in PHP 4, many code libraries and large applications (including the PEAR library) are written only using OOP code. PHP 5 fixes the OOP related weaknesses of PHP 4, and introduces a complete object model.

With PHP you are not limited to output HTML. PHP's abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content. One of the strongest and most significant features in PHP is its support for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported: Adabas D DBase Empress Hyperwave IBM DB2 Informix Ingres InterBase FrontBase mSQL MySQL ODBC Oracle (OCI7 and OCI8) Ovrimos PostgreSQL SQLite Solid Sybase Velocis Unix dbm

FilePro (read-only) Direct MS-SQL

We also have a DBX database abstraction extension allowing you to transparently use any database supported by that extension. Additionally PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard. PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects. PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, PHP 4 supports the SAX and DOM standards, and you can also use the XSLT extension to transform XML documents. PHP 5 standardizes all the XML extensions on the solid base of libxml2 and extends the feature set adding SimpleXML and XMLReader support. While using PHP in the e-commerce field, you'll find the Cybercash payment, CyberMUT, VeriSign Payflow Pro and MCVE functions useful for your online payment programs.

At last but not least, we have many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2), calendar conversion, translation... As you can see this page is not enough to list all the features and benefits PHP can offer. Read on in the sections about installing PHP, and see the function reference part for explanation of the extensions mentioned here.

What you need to build web applications To build web applications in Dreamweaver, you need the following software:
• •

A web server An application server that runs on your web server, or a web server that doubles as an application server, such as APACHE

Note: In the context of web applications, the terms “web server” and “application server” refer to software, not hardware. If you want to use a database with your application, you need the following additional software:
• •

A database or database system A database driver that supports your database

How Web Servers Work

test them and then upload them on your production server. MYSQL AND PHP Introduction WAMP5 is an installer for Windows. We have configured Apache and MySQL servers with default configuration files to have the most standard platform. 2000.x PHPmyadmin SQLitemanager Wampserver service manager WAMP5 comes with a service manager as an icon tray. These softwares are installed: Apache 2. This manager will allow you to fully control your server and local projects. a "www" directory is created in WAMP5's directory. WAMP5 requires one of these systems to work: Windows XP. PHP 5. NT. it installs a complete WAMP solution on your computer.x. WAMP5 is not designed for production but as a development environment. wherever you install them on your local drive.PHP5 WAMP5 automatically configures them to work together.x.x MySQL 5.Apache . WAMP is for : Windows .wampserver.PART 1: Installing WAMP – WINDOWS. Just put your script files (php files) in this directory and access your localhost threw an Internet Windows or the service manager (icon tray). APACHE. You can then adapt it to your personal needs.MySQL.2. With WAMP5. During installation. 2003 How To Install Download the latest release of WAMP5 on one of the WAMPSERVER sites: http://www.x. you will be able to create you scripts locally on your computer.com/en/ .

Process of Installation 1. Click -> NEXT 2.Double-click on the file to start installing. Click -> I accept the agreement 3. But don't forget that some scripts and modules don't like long names and special characters like spaces. Click -> Next . WAMP5 builds configuration files to reflect your choice. You can install wherever you want. WAMP5 will ask you where to install.

Click Next (*Recommended you to leave the default) .4. Click Next (*Recommended you to leave default directory c:\wamp) 5.

WAMP5 will then ask you if want to install the option "Auto Start". Click Install . services will be installed as automatic and a link to the service manager will be copied to your startup menu. If you check this option. services will be installed as manual and will start and stop with the service manager. 7. Click Next (*Recommended you to click the auto start) 8. Otherwise. Click auto start checkbox to make the services are autostart. 6.

Click Next (*Recommended you to leave the default) . 9. Wait until finish.Installing….

Click Yes 12. Click Finish Installation finish . Click Open (*Recommended you to leave the default) 11.10.

ini" to avoid conflicts with other installs You just have to click on the icon tray to access WAMP5's menu : .ini) is copied to the Windows directory but as "mywamp.After installation. Only the MySQL conf file (usually my. This means that all files are copied to WAMP5's directory. WAMP5's installation is compact.

The icon tray reflects the status of your server : .

phpMyAdmin and various other MySQL Front Ends and MySQL Clients in a single intuitive interface. 1.PART 2: DATABASE SQLYOG Introduction SQLyog provides you with powerful means to manage your MySQL databases. SQLyog MySQL GUI is the most popular MySQL Manager and MySQL Admin Tool. Installing SQLyog Download the latest version of SQLyog and click the setup file. combining the features of MySQL Query Browser. Click Next .

2. Click Next (*Recommended you to leave the default) . Click Next 4. Click I accept the terms in the license agreement 3.

5.Installing… wait until finish. Click Finish Finish installing and run the SQLyog. (*Make sure the wamp server is running) .

Not your FTP or webserver username. A host name where the database is situated or the IP address of the server. A TCP/IP port for connecting to the database server. You may enter several database names separated by semicolon (like db1. If you do not enter the database name. all the database names would be listed. to select from. To Change the connection. Saved Connections MySQL host address User name Password Databases Port . Note: This is MySQL username. MySQL user Password Database name. click OK button to save the changed connection name. click on the ellipsis button and edit the connection name. User name for connecting to the database server. you can make additional connections by selecting the New Connection option from the File menu.db2). Select the connection name from the list.Starting SQLyog Run SQLyog and you will see dialog box as shown below: After you have connected to an instance of MySQL.

MySQL is a functional feature on it's own. Intoduction MySQL is a database. 3.MySQL Database 1. Eg. CHAR is a fixed length string and is mainly used when the data is not going to vary much in it's length. A string with a maximum length of 4294967295 characters. There are three main types : text. Choosing the column types specifies what information can or can't be stored in a table cell. It can be used to store. VARCHAR may be a bit slower as it calculates each field down . A string with a maximum length of 16777215 characters. See appendix MySQL-1. 2. VARCHAR(20) CHAR and VARCHAR are the most widely used types. MySQL uses some specific words for command processing. the next step is to figure out the data type. For our tutorials. A string with a maximum length of 255 characters. Data Type in MySQL Once you have your table data organized. there is a number of words that you cannot use for your table and column names. Reserved Words Before getting to far into planning. numbers. A database is a data storage feature. CHAR may be faster for the database to process considering the fields stay the same length down the column. VARCHAR is a variable length string and is mainly used when the data may vary in length. A string with a maximum length of 65535 characters. sort. 3.1 Text Types CHAR( ) VARCHAR( ) TINYTEXT TEXT BLOB MEDIUMTEXT MEDIUMBLOB LONGTEXT LONGBLOB A fixed section from 0 to 255 characters long. A variable section from 0 to 255 characters long. and display information. A string with a maximum length of 4294967295 characters. A string with a maximum length of 16777215 characters. Using the most correct option for each column is important as it may affect the database's overall performance. A string with a maximum length of 65535 characters. arrange. and Dates/Times. The ( ) brackets allow you to enter a maximum number of characters will be used in the column. we will be using PHP commands to use the functions of a MySQL database. so using them in your own coding may confuse things a bit.

YYYY-MM-DD HH:MM:SS. 3.the column. Using an UNSIGNED command will move that range up so it starts at zero instead of a negative number. but they are also processed much slower. A large number with a floating decimal point. -32768 to 32767 normal 0 to 65535 UNSIGNED. ENUM is short for ENUMERATED list. ) -128 to 127 normal 0 to 255 UNSIGNED.3 Date Types DATE DATETIME TIMESTAMP TIME YYYY-MM-DD. A small number with a floating decimal point. The integer types have an extra option called UNSIGNED. They are similar to a larger version of VARCHAR. Which one to ultimatly use is up to you. YYYYMMDDHHMMSS. Eg. This column can only store one of the values that are declared in the specified list contained in the ( ) brackets. Both TEXT and BLOB are variable length types that store large amounts of data. ENUM('y'.'n') . MySQL will automatically change the CHAR into VARCHAR for compatability reasons. Normally. A DOUBLE stored as a string . Using both a CHAR and VARCHAR option in the same table. Similar to ENUM except each column may have more than one of the specified possible values. -2147483648 to 2147483647 normal 0 to 4294967295 UNSIGNED. -8388608 to 8388607 normal 0 to 16777215 UNSIGNED. but it saves on memory space. These types can store a large piece of data information. ) DECIMAL( .2 Number Types TINYINT( ) SMALLINT( ) MEDIUMINT( ) INT( ) BIGINT( ) FLOAT DOUBLE( . 3.4 Misc Types ENUM ( ) SET Short for ENUMERATION which means that each column may have one of a specified possible values. the integer goes from an negative to positive value. BLOB stands for Binary Large OBject. -9223372036854775808 to 9223372036854775807 normal 0 to 18446744073709551615 UNSIGNED. 3. allowing for a fixed decimal point. HH:MM:SS.

You are telling the database that THIS specific column is special and may help organize the data. If a value is inserted that is not in the list. NOT NULL. UNIQUE states that each cell in the column should have a unique value. UNIQUE.3 Auto Increment The AUTO_INCREMENT modifier works on any of the integer types.1 Index Indexing is a way to improve a database performance. SET is similar to ENUM except SET may contain up to 64 list items and can store more than one choice. PRIMARY KEY. AUTO_INCREMENT. BINARY. Other modifier commands are : INDEX. the integer types have an extra option called UNSIGNED. 4.You can list up to 65535 values in an ENUM list. Column Modifier A column modifier is an extra addon command to help the database organize and work better. .2 Unique and Primary Key An INDEX column may have more than one cell holding the same data value. 4. the integer goes from an negative to positive value. it would probably be the best to be an INDEX column. NULL. If there is a column you will be referring to often. the number in this column will appear and automatically increase by one from the previous row. A majority of the time you will want to specify a field to be NOT NULL so that any blank entries will be considered as "something".4 Null NULL is no value. DEFAULT. a blank value will be inserted. 4. 4. it is not zero. PRIMARY KEY is a special variety of the UNIQUE command. Each time a new row is added into the database table. The two other index types are UNIQUE and PRIMARY KEY. 4. Normally. and ZEROFILL. As mentioned on the previous page. It is not space. Using an UNSIGNED command will move that range up so it starts at zero instead of a negative number.

(The NDB storage engine was added to MySQL just before this book was printed. 4.4. which is bound to be more complicated and less clear cut.0 Table Type 5. However.5 Default DEFAULT will assign a default value to a cell if nothing is entered for the value. It doesn’t necessarily reflect the low-level implementation. It will display leading zeros of a number based on the display width.1 MySQL Architecture It will greatly aid your thinking about storage engines and the capabilities they bring to MySQL if you have a good mental picture of where they fit. 4.6 Binary BINARY is used with CHAR and VARCHAR types. It causes the values to be treated as "binary strings" making them CaSe SeNsItIvE.) . Watch for it in the second edition. 5.7 Zerofill ZEROFILL is used with numeric data types. Figure 2-1 provides a logical view of MySQL. It will work on most data types except BLOB and TEXT. it does serve as a guide that will help you understand how storage engines fit in to MySQL.

This API is made up of roughly 20 low-level functions that perform operations such as “begin a transaction” or “fetch the row that has this primary key” and so on. The storage engines don’t deal with SQL or communicate with each other. It is based on the older ISAM code but has many useful extensions. The third layer is made up of storage engines. etc. security. authentication.). For the case of a key longer than 250 bytes.2 MyIsam MyISAM is the default storage engine. (Note that MySQL 5.) MyISAM tables have the following characteristics: • • • • • All numeric key values are stored with the high byte first to allow better index compression.The topmost layer is composed of the services that aren’t unique to MySQL. Dynamic-sized rows are much less fragmented when mixing deletes with updates and inserts. optimization. The good news is that many of the differences are transparent at the query layer. Stored procedures. and all the built-in functions (dates. etc. which will arrive in MySQL 5. They’re services most network-based client/server tools or servers need: connection handling. (When an AUTO_INCREMENT column is defined as the last column of a multiple-column . they simply respond to requests from the higher levels within MySQL. Like the various filesystems available for Linux. This is done by automatically combining adjacent deleted blocks and by extending blocks if the next block is deleted. The second layer is where things get interesting. Internal handling of one AUTO_INCREMENT column per table is supported. caching. This makes AUTO_INCREMENT columns faster (at least 10%).0. 5. Values at the top of the sequence are not reused after being deleted. This can also be changed by changing the source and recompiling. The interface between the second and third layers is a single API not specific to any given storage engine. a larger key block size than the default of 1024 bytes is used. each storage engine has its own benefits and drawbacks. analysis. times. also reside in this layer. When rows are inserted in sorted order (as when you are using an AUTO_INCREMENT column). including query parsing. MyISAM automatically updates this column for INSERT and UPDATE operations. This improves space utilization in the index tree. The maximum key length is 1000 bytes. the index tree is split so that the high node only contains one key.0 does not support ISAM. Much of the brains inside MySQL live here. Any functionality provided across storage engines lives at this level. math. encryption. They’re responsible for the storage and retrieval of all data stored “in” MySQL.

Each character column can have a different character set. Its CPU efficiency is probably not matched by any other disk-based relational database engine.3 InnoDB InnoDB provides MySQL with a transaction-safe (ACID compliant) storage engine that has commit. BLOB and TEXT columns can be indexed. Dynamic-sized rows are much less fragmented when mixing deletes with updates and inserts. If a table has no free blocks in the middle of the data file. reuse of values deleted from the top of a sequence does occur. and crash recovery capabilities. If mysqld is started with the --myisam-recover option. .• • • • • • • index. You can put the data file and index file on different directories to get more speed with the DATA DIRECTORY and INDEX DIRECTORY table options to CREATE TABLE. You can freely mix InnoDB tables with tables from other MySQL storage engines. The sum of the lengths of the VARCHAR and CHAR columns in a table may be up to 64KB. even within the same statement. a VARCHAR column starts with a length stored in one or two bytes.) A free block can occur as a result of deleting rows or an update of a dynamic length row with more data than its current contents. Tables with VARCHAR columns may have fixed or dynamic row length. rollback.. This takes 0–1 bytes per key. There is no need for lock escalation in InnoDB because row-level locks fit in very little space. . InnoDB does locking on the row level and also provides an Oracle-style consistent non-locking read in SELECT statements. These features increase multi-user concurrency and performance.) The AUTO_INCREMENT value can be reset with ALTER TABLE or myisamchk. MyISAM also supports the following features: • • • Support for a true VARCHAR type. and are repaired if the table wasn't closed properly. (These are known as concurrent inserts. InnoDB also supports FOREIGN KEY constraints. InnoDB has been designed for maximum performance when processing large data volumes. MyISAM tables are automatically checked when opened. future inserts become concurrent again. There is a flag in the MyISAM index file that indicates whether the table was closed correctly. When all free blocks are used up (filled in). This is done by automatically combining adjacent deleted blocks and by extending blocks if the next block is deleted. NULL values are allowed in indexed columns. 5. you can INSERT new rows into it at the same time that other threads are reading from the table.

’Female’ 15 Male NOT NULL NOT NULL . Inc. MyISAM tables where each table is stored using separate files.org runs on InnoDB. InnoDB stores its tables and indexes in a tablespace. for example. NOT NULL NOT NULL 15 15 ‘Male’. InnoDB is included in binary distributions by default. stores over 1TB of data in InnoDB. which may consist of several files (or raw disk partitions). This is different from. The famous Internet news site Slashdot.Fully integrated with MySQL Server. InnoDB tables can be of any size even on operating systems where file size is limited to 2GB. the InnoDB storage engine maintains its own buffer pool for caching data and indexes in main memory. The Windows Essentials installer makes InnoDB the MySQL default storage engine on Windows. and another site handles an average load of 800 inserts/updates per second in InnoDB. InnoDB is used in production at numerous large database sites requiring high performance. Creating Database and Table in SQLyog Database name: student Table name: std_info Engine: MyISAM Fields: Fields_Name Datatype std_name varchar std_id double std_address text std_phone_h varchar std_phone_hp varchar std_gender enum std_origin varchar Len 100 Default 0 Other NOT NULL PK. Mytrix.

PART 3: ADOBE DREAMWEAVER 1. collaboration. Note: Users who are new to Dreamweaver are encouraged to use the Site Definition Wizard. for testing. 2. depending on your environment and the type of website you are developing: • Local folder is your working directory. . Defining Site Organizing the site structure • Break down your site into categories • Decide where to put items such as images and sound files • Use the same structure for local and remote sites Setting up a Dreamweaver site A Dreamweaver site consists of as many as three parts. production. depending on your environment.” • Remote folder is where you store your files. or click the Advanced tab to use the Advanced settings. Dreamweaver refers to this folder as your “remote site • Folder for dynamic pages is the folder where Dreamweaver processes dynamic pages. The Site Definition dialog box appears. or so on. experienced Dreamweaver users might prefer to use the Advanced settings. Select Site > New Site. To set up a Dreamweaver site: 1. Dreamweaver refers to this folder as your “local site. Click the Basic tab to use the Site Definition Wizard.

Setting Up Local Folder Setting Up Testing Server .

3. *You can click button Test to check the connection successful or not The result of the successful connection is shown below. Enter values as shown below except value for the database. . Click the plus (+) button on the Application > Databases panel and select MySQL Connection from the pop-up menu. Collapse student database and make sure the tables name exist. 2.Connecting to database To create a database connection with a MySQL Connection: 1. Click button OK to finish the configuration. 4. The MySQL Connection dialog box appears. Click button Select… and choose database student.

the information is sent to the server where a server-side script or application processes it.Creating Interactive Forms Client-side role of forms Forms support the client side of the client-server relationship. and radio buttons. The form tag includes parameters that let you specify a path to the server-side script or application that will process the form data. Microsoft Active Server Pages (ASP). The server responds by sending requested information back to the user (or client). Common server-side technologies used for processing form data include Macromedia ColdFusion. These form objects include text fields. check boxes. and which HTTP method to use when transmitting data from the browser to the server. or by accessing the form objects from the Forms panel of the Insert bar shown below. list boxes. You can insert form objects by choosing Insert > Form Objects. or performing some action based on the form’s contents. form input types are called form objects. . Forms can contain various objects that enable user interaction. Forms collect information from the user and submit this information to the server for processing. About form objects In Dreamweaver. and PHP. When a visitor enters information into a form displayed in a web browser (the client) and clicks the submit button. Forms allow you to interact with or gather information from visitors to a website.

Multiple-line text fields provide the visitor with a larger area in which to enter a response. Single-line text fields typically provide a single word or short phrase response. If the amount of data sent is too large. Typically the default is the GET method. or other confidential information. URLs are limited to 8. GET is not a secure method for passing information. do not use GET method when sending confidential user names and password. or as bullets or asterisks (for password protection). Text fields accept any type of alphanumeric entries. Text Field & Text Area Inserts a text field in a form. choose the method that will transmit the form data to the server. Any additional form objects. Appends the value to the URL requesting the page. or an address. and the . such as text fields. Also. and so on must be inserted between the form tags for the data to be processed correctly by all browsers. The form Methods are: POST GET Embeds the form data in the HTTP request. such as a name. data will be truncated. Default Uses the browser’s default setting to send the form data to the server. buttons. *In the Method pop-up menu. credit card numbers. The entered text can be displayed as a single line.192 characters. You can specify the maximum number of lines the visitor can enter. leading to unexpected or failed processing results. Do not use the GET method to send long forms. as multiple lines. Dreamweaver inserts opening and closing form tags in the HTML source code.The Forms bar provides the following buttons: Form Inserts a form in the document.

. the entered text is replaced by asterisks or bullets to obscure the text. Hidden fields let you store information entered by a user. When a user types in a password field. For example a user can select Yes or No. Selecting a button within a group deselects all others in the group. following the setting specified in the wrap attribute. Check Box Inserts a check box in a form. a user can select as many options as apply. and protect the information from being viewed. or purchase preference. Check boxes allow multiple responses in a single group of options. Radio Button Inserts a radio button in a form. e-mail address. the field will scroll. such as a name. and then use that data when the user next visits the site. If text is entered that exceeds these settings.character width of the object. Password fields are a special type of text field. Hidden Field Inserts a field in the document in which user data can be stored. Radio buttons represent exclusive choices.

A user can select only one option within a radio button group. Understanding checkboxes and radio buttons Check boxes toggle each individual response “off” and “on.” the “Rafting” button would be automatically deselected.Radio Group Inserts a collection of radio buttons which share the same name. In the example below.” Thus. . Radio buttons work as a group and provide mutually exclusive selection values. and Rafting. If the user were to click “Surfing. a user can select more than one option from a checkbox group. The example below illustrates this by showing three checkbox items selected: Surfing. “Rafting” is the currently selected option. Mountain Biking.

The Menu option displays the option values in a pop-up menu and allows users to select only a single choice. Buttons perform tasks when clicked. Jump Menu Inserts a navigational list or pop-up menu. or use one of the predefined “Submit” or “Reset” labels. Button Inserts a text button within a form. File fields let users browse to files on their hard disks and upload the files as form data. The List option displays the option values in a scrolling list and allows users to select multiple options in the list. File Field Inserts a blank text field and a Browse button in a document. such as submitting or resetting forms. .List/Menus Allows you to create user choices in a list. You can add a custom name or label to a button. Jump menus let you insert a menu in which each option links to a document or file Image Field Allows you to insert an image in a form. Image fields can be used in place of Submit buttons to make graphical buttons.

list/menu. radio button. textarea.php. The content of the file is shown below. You can change the name by selecting the form object and go to Properties Panel.php Make sure the name for each form objects are same with field name.Exercise : Create a Form as shown below (textfield. buttons and table) save as student_reg. . Text Field: Name Create new file name congra_saving.

label fields. The application object lets you select which fields to include in the form. When a user enters data in the form fields and clicks the submit button. You can also set a page to open after a record has successfully been submitted so the submitter knows the database was updated. and select the type of form objects to insert.Server Behaviors Insert Record You can use a Record Insertion Form application object to create a form which links to the fields of a database. a new record is inserted in a database. .

4. 6. Attach this action to individual text fields with the onBlur event to validate the fields as the user is filling out the form.1. Choose Insert table. Make sure in Columns all values are assigned to field name. . Click button Browse and choose file congra_saving. To make any changes. 3. 2. Choose Connection.php. Click button OK. 5. just click the behavior and you will get Insert Record dialog box again. or attach it to the form with the onSubmit event to evaluate several text fields at once when the user clicks the Submit button. In Application > Server Behaviors the Insert Behavior will be added. Validate Form The Validate Form action checks the contents of specified text fields to ensure that the user has entered the correct type of data. Attaching this action to a form prevents the form from being submitted to the server if any of the specified text fields contains invalid data.

select a text field and select Window > Behaviors. Select from one of the following Accept options: Use Anything if the field is required but need not contain any particular kind of data. o If you are validating multiple fields. 7. click the <form> tag in the tag selector in the bottom left corner of the Document window and select Window > Behaviors. select the same field that you have selected in the Document window from the Named Fields list.To use the Validate Form action in registration. check that the default event is onBlur or onChange. The difference between them is that onBlur occurs whether or not the user has typed in the field. Use Number From to check that the field contains a number in a specific range. repeat steps 3 and 4 for any additional fields that you want to validate. Select Validate Form from the Actions pop-up menu. If you are validating multiple fields when the user submits the form. 3. Do one of the following: o To validate individual fields as the user fills out the form. The onBlur event is preferred when you have specified that the field is required. 6. If you are validating individual fields. Select the Required option if the field must contain some data. Click OK. 2. 5. the onSubmit event automatically appears in the Events pop-up menu. o To validate multiple fields when the user submits the form. . Use Number to check that the field contains only numerals. the Anything option is meaningless-that is. 4. it is the same as if the Validate Form action were not attached to the field. (If the Required option is not selected. If it isn’t. and onChange occurs only if the user changed the contents of the field. select a text field from the Named Fields list. Do one of the following: o If you are validating individual fields.) Use E-mail address to check that the field contains an @ symbol. select onBlur or onChange from the pop-up menu.php 1. If you are validating multiple fields. Both of these events trigger the Validate Form action when the user moves away from the field. 8.

Named Fields std_name std_id std_phone_h std_phone_hp std_address Value Required Required Not Required Not Required Required Accept Anything Number Anything *The std_gender and std_origin do not show because both have the default values. Update and Search. . Tips: The validate form behavior also can be applied to page Log In. After click button OK the Validate Form is added in Behaviors as shown below with event onSubmit. Insert.

which defines what’s included in the recordset. . A database query consists of search criteria. You then use the information extracted as a source of content for your dynamic pages. A recordset is a subset of information extracted from a database by a database query. Click OK to close the Recordset or DataSet dialog box. • Enter the name (rsstudent) • Click Test to test the recordset ƒ ƒ Click OK to close the Test SQL Statement window. To open recordset:  Click recordset in Server Behaviors and the below recordset will appear.Recordset (Query) Now you’ll create a recordset to select the data you want to display.

4. Drag and drop the appopriate fields as shown Highlight the second row and choose Repeat Region in Server Behavior panel Highlight the table and choose Show Region if Recordset Not Empty Highlight No Student Record Available and choose Show Region if Recordset is Empty 6. Create a page as shown below: 1. 2. 5. Insert table with 2 rows and 3 columns.The recordset appears in the Bindings panel. 3. Name the page as student_list.php .

you can insert an editable region in a repeating region to make it editable. 3. 4. In Design view. After you have added a recordset to a page. 2. the Move to Last Record server behavior can take a long time to run when the user clicks the link. you must apply individual server behaviors to each navigation element. However. select the recordset containing the records.Repeating Region Lets you repeat a region but doesn’t include an editable region. For example. and have created a navigation bar. Choose Recordset Paging from the pop-up menu. In the Recordset pop-up menu. Open the Server Behaviors panel (Window > Server Behaviors) and click the plus (+) button. Note that if the recordset contains a large number of records. 5. Show Region The Show Region server behaviors are: • • • • • Show If Recordset Is Empty Show If Recordset Is Not Empty Show If First Page Show If Not First Page Show If Last Page . Click OK. then select a server behavior appropriate to that link from the listed server behaviors. select the text string or image on the page you want to use as a record navigation link. a typical recordset navigation bar contains representations of the following links matched to the appropriate behavior: Recordset Paging Navigation link Go to first page Go to the previous page Go to the next page Go to the last page Server behavior Move to first page Move to previous page Move to next page Move to last page To assign server behaviors to record navigation links: 1.

Filtering Record Set (Query) . click the plus (+) button. select the region on the page to show or hide. In the Server Behaviors panel (Window > Server Behaviors). Choose Show Region from the pop-up menu. In Design view.• Show If not Last Page To show a region only when it’s needed: 1. 4. then choose one of the listed server behaviors. 3. 2. Click OK.

2.php and click Paratemters button. Highlight {rsStudent. .php do as following: 1.# Update and Delete will be used when to update and delete the informations of the student To link page student_list and student_detail. Choose student_detail.std_name} and right click mouse and choose Make Link. The dialog box as shown as below.

Click button Dynamic under Value and select std_id. . 4. Type std_id in column Name. Click OK.3.

. Create Form as shown below.htm page. 2. Create cong_update.Update Page Before update please make sure you have done this: 1. 4. Create recordset with id as a filter.asp 3. Save as student_update. Select Update Record in Server Behavior Panel.

Click OK. 6. . 5.The Record Update Form dialog box appears. Complete the dialog box.

Save as student_delete.htm page. . Create recordset with id as a filter. 2.Delete Page Before delete please make sure you have done this: 1. Create cong_delete. Create Form as shown below.asp 3.

Open the page in Design view. The Delete Record Form dialog box appears. 6. Complete the dialog box. Click OK. then choose Insert > Application Objects > Delete Record Form. .4. 5.

5.php 4. Create menu. then choose Server Behavior > Application Objects > User Authentication > Log In User. Open the page in Design view. The Log In User Form dialog box appears.php page. Create Form as shown below. 6. 2. Complete the dialog box. . 3.php page. Save as index.Log In User Before log in please make sure you have done this: 1. Click OK. Create sorry.

APPENDIX MySQL – 1: Reserved Words ADD ANALYZE ASC BDB BETWEEN BLOB CALL CHANGE CHECK COLUMNS CONSTRAINT CROSS CURRENT_TIMESTAMP DATABASES DAY_MINUTE DECIMAL DELAYED DESCRIBE DISTINCTROW DROP ENCLOSED EXIT FETCH FOR FOUND FULLTEXT HAVING HOUR_MINUTE IGNORE INFILE INOUT INT INTO ITERATE KEYS LEAVE LIMIT LOCALTIME LONG LOOP ALL AND ASENSITIVE BEFORE BIGINT BOTH CASCADE CHAR COLLATE CONDITION CONTINUE CURRENT_DATE CURSOR DAY_HOUR DAY_SECOND DECLARE DELETE DETERMINISTIC DIV ELSE ESCAPED EXPLAIN FIELDS FORCE FRAC_SECOND GRANT HIGH_PRIORITY HOUR_SECOND IN INNER INSENSITIVE INTEGER IO_THREAD JOIN KILL LEFT LINES LOCALTIMESTAMP LONGBLOB LOW_PRIORITY ALTER AS AUTO_INCREMENT BERKELEYDB BINARY BY CASE CHARACTER COLUMN CONNECTION CREATE CURRENT_TIME DATABASE DAY_MICROSECOND DEC DEFAULT DESC DISTINCT DOUBLE ELSEIF EXISTS FALSE FLOAT FOREIGN FROM GROUP HOUR_MICROSECOND IF INDEX INNODB INSERT INTERVAL IS KEY LEADING LIKE LOAD LOCK LONGTEXT MASTER_SERVER_ID .

MATCH MEDIUMTEXT MINUTE_SECOND NOT NUMERIC OPTION ORDER OUTFILE PRIVILEGES READ REGEXP REPLACE RETURN RLIKE SENSITIVE SHOW SONAME SQL SQLWARNING SQL_SMALL_RESULT SQL_TSI_HOUR SQL_TSI_QUARTER SQL_TSI_YEAR STRAIGHT_JOIN TABLES TIMESTAMPADD TINYINT TRAILING UNION UNSIGNED USE UTC_DATE VALUES VARCHARACTER WHERE WRITE ZEROFILL MEDIUMBLOB MIDDLEINT MOD NO_WRITE_TO_BINLOG ON OPTIONALLY OUT PRECISION PROCEDURE REAL RENAME REQUIRE REVOKE SECOND_MICROSECOND SEPARATOR SMALLINT SPATIAL SQLEXCEPTION SQL_BIG_RESULT SQL_TSI_DAY SQL_TSI_MINUTE SQL_TSI_SECOND SSL STRIPED TERMINATED TIMESTAMPDIFF TINYTEXT TRUE UNIQUE UPDATE USER_RESOURCES UTC_TIME VARBINARY VARYING WHILE XOR MEDIUMINT MINUTE_MICROSECOND NATURAL NULL OPTIMIZE OR OUTER PRIMARY PURGE REFERENCES REPEAT RESTRICT RIGHT SELECT SET SOME SPECIFIC SQLSTATE SQL_CALC_FOUND_ROWS SQL_TSI_FRAC_SECOND SQL_TSI_MONTH SQL_TSI_WEEK STARTING TABLE THEN TINYBLOB TO UNDO UNLOCK USAGE USING UTC_TIMESTAMP VARCHAR WHEN WITH YEAR_MONTH .