Pages

Wednesday, February 9, 2011

PHP SWITCH STATEMENT: Changing Background Color Base on Day

I created a PHP script using a "Switch Statement" that allow a user to select day from a combobox or a dropdown menu that when a user clicks the submit button, the background color of the page changes depending on what is set. In the following example, I set 
  • Monday to color red
  • Tuesday to blue
  • Wednesday to yellow
  • Thursday to green
  • Friday to pink
  • Saturday to orange and
  • Sunday to black
Here is the HTML code:

This one is the PHP script. Copy the code and save it with a .php file extension.

Simple PHP Log In

To be able to create a simple database driven PHP Log in,
first thing to do is CREATE A DATABASE using your PhpMyadmin or anything that are applicable.
Name it db. then create a table and name it members having fieldnames such as IDUserName and Password. or simple copy the following:


-- phpMyAdmin SQL Dump
-- version 3.3.9
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 02, 2011 at 06:54 PM
-- Server version: 5.5.8
-- PHP Version: 5.3.5

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `db`
--

-- --------------------------------------------------------

-- Table structure for table `members`
--

CREATE TABLE IF NOT EXISTS `members` (
  `ID` int(10) NOT NULL AUTO_INCREMENT,
  `UserName` varchar(50) NOT NULL,
  `Password` varchar(50) NOT NULL,
   PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `members`
--

INSERT INTO `members` (`ID`, `UserName`, `Password`) VALUES
(1, 'honey', 'a'),
(2, 'a', 'a'),
(3, 'kyte', 'joy'),
(4, 'hard', '123'),
(5, 'jenny', '123');

-- --------------------------------------------------------
SECOND: Create the LOG IN script
Here's the code:
Header("Location:Write the page where you want to redirect after logging in");

Your Friendship is a Gift

God gave me out
of the abundance of His heart.

Your unwavering love, support
and affirmation is a humbling blessing from the Lord
For I am just a person with fears
and self doubts such as you have
I too have taken a lot of wrong turns,
But your involvement is the one thing
that keeps me following hard after the Lord
Your caring makes me want to live
a life that is a miracle.

In a lonely, confusing world such as ours,
Thanks for coming along!

Abbie Teh 

A very very old and inspiring poem from an old frame located at our old wall. ^_^ 

You're Like A Sister To Me

You're like a Sister to Me

The best kind of firendships
are the lasting, warm and wonderful kind
that you and I have always shared...

They're the kind where the caring never goes away,
the understanding is deep and sweet and sincere,
and the two friends are so near in their hearts
that they'll stay close forever.

I really cherish having you for a friend.
You're the very best kind there is,
and I feel privileged to know you as well as I do.
You and I have a trust, an honesty, and a history
together that make me think of you as so much more than a friend.
You're someone who is at the center of the circle of my life
and who has been a precious part of so many yesterdays.

I know you'll always stay that way,
because when a friend is as close as you are,
she's just like family.
You've always been and you always will be...

just like a sister to me.

This one's from a birthday card given to me by my friends during my debut last oct. 2007. Really Memorable that's why I keep it...Thanks to all of you!

BROKEN CHORDS: Next To The Fire Song

Found another beautiful composition!
It's a local band lead by Elmer Jun from Bacolod City, Negros Occidental.

Try watching this. Really nice song!
This is the link since sharing is disabled in this video.
http://www.youtube.com/watch?v=a-xBqMh-8yU 

Disable HTML BUTTON When Click

Here's an easy way on how to disable your html button after clicking. This is used when you want the user to click the button only once.