Book Image

PHP Ajax Cookbook

Book Image

PHP Ajax Cookbook

Overview of this book

Table of Contents (16 chapters)
PHP Ajax Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Making Form Wizards


Form Wizards are basically forms divided into several steps. They are useful for polls or special cases of forms, when we want to divide the registration process on our website. They are also used in e-commerce websites, in the purchase process (shopping cart→payment methods→shipping address→confirmation→purchase itself). In this recipe, we will build a Form Wizard (as simple as possible).

Getting ready

We will prepare the dummy PHP files step1.php, step2.php, and step3.php. The content of these files is simple:

<?php
echo "STEP 1"; // Same for 2 and 3
?>

Here again we will include jQuery library:

<script src="js/jquery-1.4.4.js"></script>

How to do it...

  1. We start by defining the HTML content:

    <div class="wizard">
      <ul class="wizardNavigation">
        <li class="active first" id="step1">Step 1</li>
        <li id="step2">Step 2</li>
        <li id="step3" class="last">Step 3</li>
      </ul>
      <div class="wizardBody...