Database Articles

  Home arrow Database Articles arrow Page 11 - Create dynamic sites with PHP & MySQL
DATABASE ARTICLES

Create dynamic sites with PHP & MySQL
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 54
    2002-05-19

    Table of Contents:
  • Create dynamic sites with PHP & MySQL
  • Introduction and installation
  • Installing Apache server routines
  • Installing MySQL
  • Installing PHP
  • Your first script
  • Your first database
  • Where's my view?
  • Creating an HTML form
  • Putting it together
  • Passing variables
  • Viewing individual rows
  • Deleting rows
  • Editing data
  • Searching our data
  • Tips for common tasks

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Create dynamic sites with PHP & MySQL - Passing variables


    (Page 11 of 16 )

    Let's take a different view now and consider how information can be passed to another PHP page. One method is by using forms as we have done already; another is by using query strings. What are query strings? Change the line method="post" to method="get" in our script input. php. Now try submitting new data into the database with it. After clicking submit you will see our familiar "Thank you! Information entered" in the browser. But look at the URL. It looks something like:

    http://yourhost/input.php?first=Rick&last=Denver&nickname=Mike&email=j@xyz.com&salary=25000&submit=Enter+information

    Look closely. Now the information is passed as a string in the URL instead of posting directly. The sentence after the ? is the query string, and as you can see it contains the name of the variable and its values. When PHP receives a query string like ?first=John it automatically creates a variable named $first and assigns the value from the query string to it. So it is equivalent to $first="John"; When more than one variable is present, the variables are separated by an ampersand (&).

    If you don't have the register_globals=on option enabled, be sure to initialize the variables with $_GET like $first=$_GET[first];

    More Database Articles Articles
    More By Codewalkers

    blog comments powered by Disqus

    DATABASE ARTICLES ARTICLES

    - Completing a Book Inventory Management System
    - Uploading Images for a Book Inventory Manage...
    - Finishing the Add Book Story for a Book Inve...
    - Integration Testing for a Book Inventory Man...
    - User Stories for a Book Inventory Management...
    - Unit Testing a Book Inventory Management Sys...
    - Testing a Book Inventory Management System
    - Implementing Models for a Book Inventory Man...
    - Book Inventory Application: Publishers and B...
    - Handling Publishers in a Book Inventory Mana...
    - Publisher Administration for Book Inventory ...
    - Book Inventory Management
    - Using the SQL Reference Manual
    - Using Oracle SQL Developer with SQL Statemen...
    - Fixing Errors with Oracle SQL Developer


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap