SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
Creating an event registration application in PHP - Part 1: Building
         the front end
         Requirements
         Prerequisite knowledge

         You'll need to know how to set up a dynamic site in Dreamweaver and also have PHP and MySQL set up on your development system. You'll also
         need to understand how to restore a SQL file to a MySQL database.

         User level

         Intermediate

         Meetings, conventions, and conferences are an important part of almost every profession. In recent years, attendee registration has moved to the Web.
         In this article you'll learn how to create a multipurpose catalog page that displays the different seminars for each day of the event. You'll also learn
         how to create a basic event registration application in PHP using a basic Dreamweaver server behavior. This application consists of three pages:

               Presentations.php: Before site visitors can decide which program to register for, they need to see what is offered on each day. This page
               dynamically displays presentation information for each day of the event.
               Register.php: This page contains a basic form for gathering name and e-mail address from the registrant; it inserts a new record into the
               MySQL database. After the record is inserted the page is redirected to confirm_register.php.
               Confirm_register.php: A simple page that let's the registrant know the process is complete.

         Getting started

         Before you begin building the application, examine the database tables that are employed and also verify that the database connection is properly set
         up in Dreamweaver.

         Note: It's a good idea to have your dynamic PHP site already set up at this point and have unpacked the sample files into the local root folder.

         Understanding the database schema

         The database that accompanies this article is a relatively simple one with three tables: presentations, registrants, and admin. Only the first two tables
         come into play during this exercise; the admin table is used in conjunction with a related article that describes how to set up an administrative site for
         event registration.

         The presentations table maintains information for the various sessions held during the event. The presentations table includes data columns for
         storing the presentation's name, a short description and a longer description (see Figure 1). There are also columns for the date and time of the talk,
         its duration and the day of the event (1, 2, 3, and so on) on which the presentation is given. Speaker details, such as name and file name for a picture,
         round out the table schema.




1 of 8
Figure 1. The presentations database schema

         In comparison, the registrants table has far fewer data columns. Only columns for the registrant's first name, last name, e-mail address, and event
         name are included. You could and probably would require a much more robust set of data columns for an actual application, but this structure should
         give you a good sense of the type of information you can gather.

         The SQL file for the Subscriptions database is included in the sample files download, in the database folder. You can recreate it on your test server
         through any number of utilities including phpMyAdmin, MySQL Control Center, or MySQL Administrator.

         Making the database connection

         After you've established your database, it's time to create a connection to it in Dreamweaver. To do so, follow these steps:

            1. Choose Window > Databases.
            2. Click Add (+) and choose MySQL Connection from the menu.
            3. In the MySQL Connection dialog box appears, do the following (see Figure 2):
                      Enter the name of your new connection in the Connection name field (for example, connEventReg).
                      Enter an IP address or MySQL server name in the MySQL server field. If you're working with a local development system, enter
                      localhost.
                      Insert your user name and password in the appropriate fields.
                      Click Select to display the available databases; choose the one you want from the list.




         Figure 2. The Dreamweaver database connection

            4. Click Test to verify the connection and then OK if the connection is successful.

         With your PHP dynamic site, MySQL database, and Dreamweaver connection all established, you're ready to build the first page of the application.




2 of 8
Displaying the event presentations

         To help your registrants decide which days of your event to attend, you'll want to display the session details. This information is stored in the
         presentations table of the database and can be called up dynamically. In this exercise, you'll create the necessary recordset, insert the dynamic data,
         and set up links to display what's happening on the various days.

         Establishing the recordset

         The first task is to add the recordset to the page. This recordset pulls data from the presentations table and is filtered to include only the sessions on a
         single day. A URL parameter is used to create the filter.

            1. Choose File > Open. When the Open dialog box appears, navigate to the event_reg subfolder of the sample files folder and open
               presentations.php.

               The presentations.php page has a few placeholders already set up to help guide you. Before you can take advantage of them, you'll need to
               create a recordset.

            2. From the Bindings panel, choose Add (+) and select Recordset from the list.
            3. When the Recordset dialog box opens, make sure you're in Simple mode and enter an appropriate name for the recordset in the Name field (for
               example, rsPresentations).
            4. Choose your data source connection from the Connection list; mine is called connEventReg.
            5. Select the table from the Table list, like presentations.
            6. Leave all the columns selected.

               For your own application, you can, of course, limit the data columns to just those used.

            7. Set the filter to the following setting:
                     PresentDay: =
                     URL Parameter: PresentDay
            8. From the Sort lists, choose PresentDate Ascending. Do not click OK just yet.

               Although you've completed the Simple view of the recordset (see Figure 3), you're not quite done. To make sure that the first day's events are
               displayed when the page loads initially, you'll need to change the default value of the URL parameter in the Advanced Recordset interface.




         Figure 3. Establishing the recordset

           9. Switch to Advanced.
          10. In the Variables section, click Edit. When the Edit Variables dialog box appears, change the Default value from -1 to 1. Click OK to close the
              dialog box.




3 of 8
Figure 4. Setting up the proper default value

           11. Click OK once more to close the Recordset dialog box.

         Now that the recordset is ready to go, you're all set to bind the dynamic data to the page.

         Binding the data

         Inserting the dynamic data to the page is pretty straightforward and made even simpler with the placeholder elements to show you the way. The only
         tricky part is formatting the date and time properly; to accomplish this, you'll need to add a bit of hand coding to the page.

            1. From the Bindings panel, expand the Recordset (rsPresentations) entry so you can see all the available data columns (see Figure 5).




         Figure 5. Available data columns

            2. Select the placeholder letter [X] in the main heading. From the Bindings panel, choose PresentDay and click Insert.

               This action allows the page to indicate which day of the event is currently being displayed.

            3. Select the placeholder letter [Presentation name] in the main heading. From the Bindings panel, choose PresentName and click Insert (see
               Figure 6).




4 of 8
Figure 6. Binding dynamic data to the page

            4. Repeat step 3 with the remaining placeholder text elements:
                     [Short Description]: PresentDescShort
                     [Date and time]: PresentDate
                     [Speaker Name]: PresentSpeaker
                     [Full Description]: PresentDescFull
            5. At this point you can make the image dynamic. Double-click the placeholder image; when the Select Image Source dialog box appears, choose
               the Data Sources option. From the Field list, choose PresentPic. In the URL field, prepend the code with the following path: images/. Click OK
               to confirm your choices.




         Figure 7. Specifying a dynamic image

         Next, set up the proper date and time formatting. As I mentioned, this will require a bit of hand-coding.

            6. Select the dynamic data {rsPresentations.PresentDate} and switch to Code view. Change the selected code to include the following sections in
               red:

         <?php echo date("l, F j, Y, g:i a", strtotime($row_rsPresentations['PresentDate'])); ?>

         Dreamweaver does not provide a binding panel format for date and time with PHP, so you have to add it yourself. There are two functions applied to
         the recordset row: date() and strtotime(). The innermost function, strtotime(), converts the string stored in the database to a time format that
         PHP can manipulate. The date() function handles the formatting. At runtime, these single letter formatting codes will result in output like this:



5 of 8
Saturday, March 1, 2008, 9:00 am. For more information about date and time formatting, see the PHP online manual.

            7. The next step is to set up the Day 1 and Day 2 links. Select the text Day 1 and, in the Property inspector, enter
               presentations.php?PresentDay=1 in the Link field. Next select Day 2 and enter presentations.php?PresentDay=2 in its Link field.

               Here, each link is set to the current page with a different value for the URL parameter PresentDay, which, you'll recall, was used to filter the
               recordset.

            8. Choose File > Save.

         The core of the dynamic information is all in place (see Figure 8).




         Figure 8. All dynamic data is inserted

         Next, you'll make sure you get all the data you need.

         Repeating the records

         At this point, the page would display a single record. For the final phase, you'll add a Repeat Region server behavior to display all the records in the
         recordset.

            1. Select all the dynamic data from rsPresentations.PresentName through rsPresentations.PresentDescFull and include the paragraph following.

               When you select the data to be repeated, you generally want to make sure to include a bit of space after the day so that each record will be
               given its proper weight. You could, of course, enclose everything in a <div> tag and handle the separation through CSS.

            2. From the Server Behaviors panel, click Add (+) and choose Repeat Region from the list.
            3. When the Repeat Region dialog box appears, make sure that rsPresentations is displayed in the Recordset list and choose Show: All records
               (see Figure 9). Click OK.




6 of 8
Figure 9. Setting up a repeat region

            4. Choose File > Save.
            5. To test your page, press F12 to preview in your testing server. After you've looked over the info, click the Day 2 link to review the second day's
               sessions (see Figure 10).




         Figure 10. Previewing the page

         Naturally, you can add as many days to your event listing as needed. Next, you'll create the registration page.

         Creating the registration page

         The registration page makes the most of the Dreamweaver Insert Record server behavior. A simple form is used to gather the needed information.

            1. Choose File > Open. When the Open dialog box appears, navigate to the event_reg folder of the sample files folder and open register.php.

               The register.php page already has the form and primary form elements in place. If you select any of the existing form elements, you'll notice
               that they are named the same as the corresponding data columns in the registrants table. There's even a hidden form element called RegEvent
               with the value for this event, Realty Conference. The key action now is to add the Insert Record server behavior.

            2. From the Server Behaviors panel, click Add (+) and choose Insert Record from the list.
            3. When the Insert Record dialog box opens, do the following:
                    Make sure that the Submit values from list is set to form1, the name of the current form.
                    From the Connection list, choose connEventReg.



7 of 8
From the Insert table list, choose registrants.

               Because all the form elements have the same name as the data columns in the registrants table, Dreamweaver automatically makes the
               assignments (see Figure 11).




         Figure 11. Setting up the Insert Record server behavior

            4. Click Browse and choose confirm_register.php for the After inserting, go to option. Click OK.

               Dreamweaver writes out the server side code indicating the entire form is now dynamic (see Figure 12) and you're good to go!




         Figure 12. The registration page is complete

            5. Choose File > Save.
            6. To test your page, press F12 and enter data for a new registrant in your browser. You'll need to examine the database records using a tool like
               phpMyAdmin or MySQL Query Browser to verify the data has been added properly.

         The confirm_registration page is a simple "thank you" page that informs the registrant that his information has been received. Your basic event
         registration application is now complete.




8 of 8

Mais conteúdo relacionado

Mais procurados

RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
GEBS Reporting
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
Aram SE
 
Access lesson 03 Creating Queries
Access lesson 03 Creating QueriesAccess lesson 03 Creating Queries
Access lesson 03 Creating Queries
Aram SE
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
guest92a5de
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating Access
Aram SE
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
Aram SE
 

Mais procurados (19)

RPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usageRPE - Template formating, style and stylesheet usage
RPE - Template formating, style and stylesheet usage
 
Sq lite manager
Sq lite managerSq lite manager
Sq lite manager
 
Sq lite module6
Sq lite module6Sq lite module6
Sq lite module6
 
Access lesson 02 Creating a Database
Access lesson 02 Creating a DatabaseAccess lesson 02 Creating a Database
Access lesson 02 Creating a Database
 
SugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-InSugarCRM Lotus Notes Plug-In
SugarCRM Lotus Notes Plug-In
 
Jazz
JazzJazz
Jazz
 
Tutorial Search With Custom Column Slide Share
Tutorial Search With Custom Column Slide ShareTutorial Search With Custom Column Slide Share
Tutorial Search With Custom Column Slide Share
 
VB6 Using ADO Data Control
VB6 Using ADO Data ControlVB6 Using ADO Data Control
VB6 Using ADO Data Control
 
Sq lite module7
Sq lite module7Sq lite module7
Sq lite module7
 
Testing File
Testing FileTesting File
Testing File
 
2.3.1 creating database, table and relationship on Access 2003
2.3.1 creating database, table and relationship on Access 20032.3.1 creating database, table and relationship on Access 2003
2.3.1 creating database, table and relationship on Access 2003
 
Access lesson 03 Creating Queries
Access lesson 03 Creating QueriesAccess lesson 03 Creating Queries
Access lesson 03 Creating Queries
 
XLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & TricksXLS PE How To Tutorials Tips & Tricks
XLS PE How To Tutorials Tips & Tricks
 
lecture 5
 lecture 5 lecture 5
lecture 5
 
Web applications configurator_administrator_guide(e)
Web applications configurator_administrator_guide(e)Web applications configurator_administrator_guide(e)
Web applications configurator_administrator_guide(e)
 
Access lesson 06 Integrating Access
Access lesson 06  Integrating AccessAccess lesson 06  Integrating Access
Access lesson 06 Integrating Access
 
Nota ms access 2007
Nota ms access 2007Nota ms access 2007
Nota ms access 2007
 
Doc Ext Configs - free application to manage data in IBM ( Lotus ) Notes / Do...
Doc Ext Configs - free application to manage data in IBM ( Lotus ) Notes / Do...Doc Ext Configs - free application to manage data in IBM ( Lotus ) Notes / Do...
Doc Ext Configs - free application to manage data in IBM ( Lotus ) Notes / Do...
 
Access lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying FormsAccess lesson 04 Creating and Modifying Forms
Access lesson 04 Creating and Modifying Forms
 

Destaque

Sjohnson1 powerpoint 2
Sjohnson1 powerpoint 2Sjohnson1 powerpoint 2
Sjohnson1 powerpoint 2
41142391
 
Jeisane fiona mpp final
Jeisane fiona mpp finalJeisane fiona mpp final
Jeisane fiona mpp final
VasseSep2010
 
Lep awards winners2010
Lep awards winners2010Lep awards winners2010
Lep awards winners2010
stoliros
 
Neo 10 21-2013
Neo 10 21-2013Neo 10 21-2013
Neo 10 21-2013
M.T. Ray
 
AERA Adaptation of Health Education Curricula
AERA  Adaptation of Health Education Curricula AERA  Adaptation of Health Education Curricula
AERA Adaptation of Health Education Curricula
rmchpe
 

Destaque (20)

4th quarter 17 php & my sql registration page
4th quarter   17 php & my sql registration page4th quarter   17 php & my sql registration page
4th quarter 17 php & my sql registration page
 
Ecosistemas bio 4º
Ecosistemas bio 4ºEcosistemas bio 4º
Ecosistemas bio 4º
 
Jenis jenis instrumen dalam pengumpulan data
Jenis jenis instrumen dalam pengumpulan dataJenis jenis instrumen dalam pengumpulan data
Jenis jenis instrumen dalam pengumpulan data
 
Presentation1
Presentation1Presentation1
Presentation1
 
Hachioji.pm #13 LT
Hachioji.pm #13 LTHachioji.pm #13 LT
Hachioji.pm #13 LT
 
Sjohnson1 powerpoint 2
Sjohnson1 powerpoint 2Sjohnson1 powerpoint 2
Sjohnson1 powerpoint 2
 
Jeisane fiona mpp final
Jeisane fiona mpp finalJeisane fiona mpp final
Jeisane fiona mpp final
 
Information Technology and people's science organisation
Information Technology and people's science organisationInformation Technology and people's science organisation
Information Technology and people's science organisation
 
Finding My Future 2016
Finding My Future 2016Finding My Future 2016
Finding My Future 2016
 
Presentation
PresentationPresentation
Presentation
 
Lep awards winners2010
Lep awards winners2010Lep awards winners2010
Lep awards winners2010
 
Neo 10 21-2013
Neo 10 21-2013Neo 10 21-2013
Neo 10 21-2013
 
prueba
pruebaprueba
prueba
 
UX Riga meetup personas
UX Riga meetup personasUX Riga meetup personas
UX Riga meetup personas
 
Heather
Heather     Heather
Heather
 
Kozma Szilárd: Nagy Attila Puli, avagy az árnyék én a sorsképlet tükrében
Kozma Szilárd: Nagy Attila Puli, avagy az árnyék én a sorsképlet tükrébenKozma Szilárd: Nagy Attila Puli, avagy az árnyék én a sorsképlet tükrében
Kozma Szilárd: Nagy Attila Puli, avagy az árnyék én a sorsképlet tükrében
 
CASA ALEGRE TERRASSA
CASA ALEGRE TERRASSACASA ALEGRE TERRASSA
CASA ALEGRE TERRASSA
 
Tema 11
Tema 11Tema 11
Tema 11
 
Social Media Marketing Solution for Dentists
Social Media Marketing Solution for DentistsSocial Media Marketing Solution for Dentists
Social Media Marketing Solution for Dentists
 
AERA Adaptation of Health Education Curricula
AERA  Adaptation of Health Education Curricula AERA  Adaptation of Health Education Curricula
AERA Adaptation of Health Education Curricula
 

Semelhante a Events Registration System Part 1

Dynamic Web Pages Ch 4 V1.0
Dynamic Web Pages Ch 4 V1.0Dynamic Web Pages Ch 4 V1.0
Dynamic Web Pages Ch 4 V1.0
Cathie101
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry university
lhkslkdh89009
 
Previous weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docxPrevious weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docx
keilenettie
 
Part 4 working with databases
Part 4 working with databasesPart 4 working with databases
Part 4 working with databases
techbed
 
Create a basic performance point dashboard epc
Create a basic performance point dashboard   epcCreate a basic performance point dashboard   epc
Create a basic performance point dashboard epc
EPC Group
 

Semelhante a Events Registration System Part 1 (20)

Tutorial on how to load images in crystal reports dynamically using visual ba...
Tutorial on how to load images in crystal reports dynamically using visual ba...Tutorial on how to load images in crystal reports dynamically using visual ba...
Tutorial on how to load images in crystal reports dynamically using visual ba...
 
Dynamic Web Pages Ch 4 V1.0
Dynamic Web Pages Ch 4 V1.0Dynamic Web Pages Ch 4 V1.0
Dynamic Web Pages Ch 4 V1.0
 
OBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation StepsOBIEE 11g : Repository Creation Steps
OBIEE 11g : Repository Creation Steps
 
Mca 504 dotnet_unit5
Mca 504 dotnet_unit5Mca 504 dotnet_unit5
Mca 504 dotnet_unit5
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry university
 
Big Data: Querying complex JSON data with BigInsights and Hadoop
Big Data:  Querying complex JSON data with BigInsights and HadoopBig Data:  Querying complex JSON data with BigInsights and Hadoop
Big Data: Querying complex JSON data with BigInsights and Hadoop
 
Creating a repository using the oracle business intelligence administration tool
Creating a repository using the oracle business intelligence administration toolCreating a repository using the oracle business intelligence administration tool
Creating a repository using the oracle business intelligence administration tool
 
Previous weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docxPrevious weeks work has been uploaded as well as any other pieces ne.docx
Previous weeks work has been uploaded as well as any other pieces ne.docx
 
Oracle ADF 11g Tutorial
Oracle ADF 11g TutorialOracle ADF 11g Tutorial
Oracle ADF 11g Tutorial
 
XPages - The Ties That Bind
XPages - The Ties That BindXPages - The Ties That Bind
XPages - The Ties That Bind
 
obiee-training-obiee-11g-bi-publisher.pdf
obiee-training-obiee-11g-bi-publisher.pdfobiee-training-obiee-11g-bi-publisher.pdf
obiee-training-obiee-11g-bi-publisher.pdf
 
A
AA
A
 
Archive data in sap
Archive data in sapArchive data in sap
Archive data in sap
 
Part 4 working with databases
Part 4 working with databasesPart 4 working with databases
Part 4 working with databases
 
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
ChircuVictor StefircaMadalin rad_aspmvc3_wcf_vs2010
 
Lotus Domino
Lotus DominoLotus Domino
Lotus Domino
 
Open microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutletOpen microsoft visual studio/tutorialoutlet
Open microsoft visual studio/tutorialoutlet
 
Create a basic performance point dashboard epc
Create a basic performance point dashboard   epcCreate a basic performance point dashboard   epc
Create a basic performance point dashboard epc
 
Dw cs3-introduction
Dw cs3-introductionDw cs3-introduction
Dw cs3-introduction
 
Developing RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdfDeveloping RIA Web Applications with Oracle ADF.pdf
Developing RIA Web Applications with Oracle ADF.pdf
 

Mais de Adolfo Nasol

Drupal debugging tips
Drupal debugging tipsDrupal debugging tips
Drupal debugging tips
Adolfo Nasol
 
Installing mandriva linux mandriva community wiki
Installing mandriva linux   mandriva community wikiInstalling mandriva linux   mandriva community wiki
Installing mandriva linux mandriva community wiki
Adolfo Nasol
 
Creating Drupal 7 subtheme
Creating Drupal 7 subthemeCreating Drupal 7 subtheme
Creating Drupal 7 subtheme
Adolfo Nasol
 

Mais de Adolfo Nasol (13)

Drupal debugging tips
Drupal debugging tipsDrupal debugging tips
Drupal debugging tips
 
Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2Mysql cheatsheet - Part 2
Mysql cheatsheet - Part 2
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
 
Managing drupal views in code
Managing drupal views in codeManaging drupal views in code
Managing drupal views in code
 
Installing mandriva linux mandriva community wiki
Installing mandriva linux   mandriva community wikiInstalling mandriva linux   mandriva community wiki
Installing mandriva linux mandriva community wiki
 
Drush for drupal website builder
Drush for drupal website builderDrush for drupal website builder
Drush for drupal website builder
 
Converting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 ThemeConverting (X)HTML/CSS template to Drupal 7 Theme
Converting (X)HTML/CSS template to Drupal 7 Theme
 
Research methods
Research methodsResearch methods
Research methods
 
Personality
PersonalityPersonality
Personality
 
Creating Drupal 7 subtheme
Creating Drupal 7 subthemeCreating Drupal 7 subtheme
Creating Drupal 7 subtheme
 
Chs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioningChs nc2 reviewer - with oral questioning
Chs nc2 reviewer - with oral questioning
 
Operating System Concepts : Reports
Operating System Concepts : ReportsOperating System Concepts : Reports
Operating System Concepts : Reports
 
Drupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web adminDrupal Checklist for Site Builder and Web admin
Drupal Checklist for Site Builder and Web admin
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Events Registration System Part 1

  • 1. Creating an event registration application in PHP - Part 1: Building the front end Requirements Prerequisite knowledge You'll need to know how to set up a dynamic site in Dreamweaver and also have PHP and MySQL set up on your development system. You'll also need to understand how to restore a SQL file to a MySQL database. User level Intermediate Meetings, conventions, and conferences are an important part of almost every profession. In recent years, attendee registration has moved to the Web. In this article you'll learn how to create a multipurpose catalog page that displays the different seminars for each day of the event. You'll also learn how to create a basic event registration application in PHP using a basic Dreamweaver server behavior. This application consists of three pages: Presentations.php: Before site visitors can decide which program to register for, they need to see what is offered on each day. This page dynamically displays presentation information for each day of the event. Register.php: This page contains a basic form for gathering name and e-mail address from the registrant; it inserts a new record into the MySQL database. After the record is inserted the page is redirected to confirm_register.php. Confirm_register.php: A simple page that let's the registrant know the process is complete. Getting started Before you begin building the application, examine the database tables that are employed and also verify that the database connection is properly set up in Dreamweaver. Note: It's a good idea to have your dynamic PHP site already set up at this point and have unpacked the sample files into the local root folder. Understanding the database schema The database that accompanies this article is a relatively simple one with three tables: presentations, registrants, and admin. Only the first two tables come into play during this exercise; the admin table is used in conjunction with a related article that describes how to set up an administrative site for event registration. The presentations table maintains information for the various sessions held during the event. The presentations table includes data columns for storing the presentation's name, a short description and a longer description (see Figure 1). There are also columns for the date and time of the talk, its duration and the day of the event (1, 2, 3, and so on) on which the presentation is given. Speaker details, such as name and file name for a picture, round out the table schema. 1 of 8
  • 2. Figure 1. The presentations database schema In comparison, the registrants table has far fewer data columns. Only columns for the registrant's first name, last name, e-mail address, and event name are included. You could and probably would require a much more robust set of data columns for an actual application, but this structure should give you a good sense of the type of information you can gather. The SQL file for the Subscriptions database is included in the sample files download, in the database folder. You can recreate it on your test server through any number of utilities including phpMyAdmin, MySQL Control Center, or MySQL Administrator. Making the database connection After you've established your database, it's time to create a connection to it in Dreamweaver. To do so, follow these steps: 1. Choose Window > Databases. 2. Click Add (+) and choose MySQL Connection from the menu. 3. In the MySQL Connection dialog box appears, do the following (see Figure 2): Enter the name of your new connection in the Connection name field (for example, connEventReg). Enter an IP address or MySQL server name in the MySQL server field. If you're working with a local development system, enter localhost. Insert your user name and password in the appropriate fields. Click Select to display the available databases; choose the one you want from the list. Figure 2. The Dreamweaver database connection 4. Click Test to verify the connection and then OK if the connection is successful. With your PHP dynamic site, MySQL database, and Dreamweaver connection all established, you're ready to build the first page of the application. 2 of 8
  • 3. Displaying the event presentations To help your registrants decide which days of your event to attend, you'll want to display the session details. This information is stored in the presentations table of the database and can be called up dynamically. In this exercise, you'll create the necessary recordset, insert the dynamic data, and set up links to display what's happening on the various days. Establishing the recordset The first task is to add the recordset to the page. This recordset pulls data from the presentations table and is filtered to include only the sessions on a single day. A URL parameter is used to create the filter. 1. Choose File > Open. When the Open dialog box appears, navigate to the event_reg subfolder of the sample files folder and open presentations.php. The presentations.php page has a few placeholders already set up to help guide you. Before you can take advantage of them, you'll need to create a recordset. 2. From the Bindings panel, choose Add (+) and select Recordset from the list. 3. When the Recordset dialog box opens, make sure you're in Simple mode and enter an appropriate name for the recordset in the Name field (for example, rsPresentations). 4. Choose your data source connection from the Connection list; mine is called connEventReg. 5. Select the table from the Table list, like presentations. 6. Leave all the columns selected. For your own application, you can, of course, limit the data columns to just those used. 7. Set the filter to the following setting: PresentDay: = URL Parameter: PresentDay 8. From the Sort lists, choose PresentDate Ascending. Do not click OK just yet. Although you've completed the Simple view of the recordset (see Figure 3), you're not quite done. To make sure that the first day's events are displayed when the page loads initially, you'll need to change the default value of the URL parameter in the Advanced Recordset interface. Figure 3. Establishing the recordset 9. Switch to Advanced. 10. In the Variables section, click Edit. When the Edit Variables dialog box appears, change the Default value from -1 to 1. Click OK to close the dialog box. 3 of 8
  • 4. Figure 4. Setting up the proper default value 11. Click OK once more to close the Recordset dialog box. Now that the recordset is ready to go, you're all set to bind the dynamic data to the page. Binding the data Inserting the dynamic data to the page is pretty straightforward and made even simpler with the placeholder elements to show you the way. The only tricky part is formatting the date and time properly; to accomplish this, you'll need to add a bit of hand coding to the page. 1. From the Bindings panel, expand the Recordset (rsPresentations) entry so you can see all the available data columns (see Figure 5). Figure 5. Available data columns 2. Select the placeholder letter [X] in the main heading. From the Bindings panel, choose PresentDay and click Insert. This action allows the page to indicate which day of the event is currently being displayed. 3. Select the placeholder letter [Presentation name] in the main heading. From the Bindings panel, choose PresentName and click Insert (see Figure 6). 4 of 8
  • 5. Figure 6. Binding dynamic data to the page 4. Repeat step 3 with the remaining placeholder text elements: [Short Description]: PresentDescShort [Date and time]: PresentDate [Speaker Name]: PresentSpeaker [Full Description]: PresentDescFull 5. At this point you can make the image dynamic. Double-click the placeholder image; when the Select Image Source dialog box appears, choose the Data Sources option. From the Field list, choose PresentPic. In the URL field, prepend the code with the following path: images/. Click OK to confirm your choices. Figure 7. Specifying a dynamic image Next, set up the proper date and time formatting. As I mentioned, this will require a bit of hand-coding. 6. Select the dynamic data {rsPresentations.PresentDate} and switch to Code view. Change the selected code to include the following sections in red: <?php echo date("l, F j, Y, g:i a", strtotime($row_rsPresentations['PresentDate'])); ?> Dreamweaver does not provide a binding panel format for date and time with PHP, so you have to add it yourself. There are two functions applied to the recordset row: date() and strtotime(). The innermost function, strtotime(), converts the string stored in the database to a time format that PHP can manipulate. The date() function handles the formatting. At runtime, these single letter formatting codes will result in output like this: 5 of 8
  • 6. Saturday, March 1, 2008, 9:00 am. For more information about date and time formatting, see the PHP online manual. 7. The next step is to set up the Day 1 and Day 2 links. Select the text Day 1 and, in the Property inspector, enter presentations.php?PresentDay=1 in the Link field. Next select Day 2 and enter presentations.php?PresentDay=2 in its Link field. Here, each link is set to the current page with a different value for the URL parameter PresentDay, which, you'll recall, was used to filter the recordset. 8. Choose File > Save. The core of the dynamic information is all in place (see Figure 8). Figure 8. All dynamic data is inserted Next, you'll make sure you get all the data you need. Repeating the records At this point, the page would display a single record. For the final phase, you'll add a Repeat Region server behavior to display all the records in the recordset. 1. Select all the dynamic data from rsPresentations.PresentName through rsPresentations.PresentDescFull and include the paragraph following. When you select the data to be repeated, you generally want to make sure to include a bit of space after the day so that each record will be given its proper weight. You could, of course, enclose everything in a <div> tag and handle the separation through CSS. 2. From the Server Behaviors panel, click Add (+) and choose Repeat Region from the list. 3. When the Repeat Region dialog box appears, make sure that rsPresentations is displayed in the Recordset list and choose Show: All records (see Figure 9). Click OK. 6 of 8
  • 7. Figure 9. Setting up a repeat region 4. Choose File > Save. 5. To test your page, press F12 to preview in your testing server. After you've looked over the info, click the Day 2 link to review the second day's sessions (see Figure 10). Figure 10. Previewing the page Naturally, you can add as many days to your event listing as needed. Next, you'll create the registration page. Creating the registration page The registration page makes the most of the Dreamweaver Insert Record server behavior. A simple form is used to gather the needed information. 1. Choose File > Open. When the Open dialog box appears, navigate to the event_reg folder of the sample files folder and open register.php. The register.php page already has the form and primary form elements in place. If you select any of the existing form elements, you'll notice that they are named the same as the corresponding data columns in the registrants table. There's even a hidden form element called RegEvent with the value for this event, Realty Conference. The key action now is to add the Insert Record server behavior. 2. From the Server Behaviors panel, click Add (+) and choose Insert Record from the list. 3. When the Insert Record dialog box opens, do the following: Make sure that the Submit values from list is set to form1, the name of the current form. From the Connection list, choose connEventReg. 7 of 8
  • 8. From the Insert table list, choose registrants. Because all the form elements have the same name as the data columns in the registrants table, Dreamweaver automatically makes the assignments (see Figure 11). Figure 11. Setting up the Insert Record server behavior 4. Click Browse and choose confirm_register.php for the After inserting, go to option. Click OK. Dreamweaver writes out the server side code indicating the entire form is now dynamic (see Figure 12) and you're good to go! Figure 12. The registration page is complete 5. Choose File > Save. 6. To test your page, press F12 and enter data for a new registrant in your browser. You'll need to examine the database records using a tool like phpMyAdmin or MySQL Query Browser to verify the data has been added properly. The confirm_registration page is a simple "thank you" page that informs the registrant that his information has been received. Your basic event registration application is now complete. 8 of 8