If statement

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
planketa
New php-forum User
New php-forum User
Posts: 152
Joined: Mon Mar 08, 2004 12:29 am
Location: Philippines

Sun Aug 07, 2005 11:27 pm

Guys,

I know this is a bit stupid.

I have a link that i only want to show if there is a data on a database field

Lets say i have 3 fields in my db, Name, Age and Email

If i retreive that data and show it on a page, i want that there is a link to appear whenevera there is an email.

If there is now email there will be no link.

Example

Name: Dexter

Age: 24

Email: dracho@adb.org

Please click here to register

The text please click here to register will only appear if there is data on the email field.

please help. thanks.
PHP Rules

User avatar
ameenov
New php-forum User
New php-forum User
Posts: 70
Joined: Mon Jun 13, 2005 2:03 am
Location: Bahrain
Contact:

Mon Aug 08, 2005 1:03 am

It is easy
I will use (!)
It means (NOT)

If email not blank than print (Please click here to register )

===============

Code: Select all

if (!$email=='') {
print "Please click here to register ";
}

User avatar
planketa
New php-forum User
New php-forum User
Posts: 152
Joined: Mon Mar 08, 2004 12:29 am
Location: Philippines

Mon Aug 08, 2005 4:51 pm

ei thanks, yes that was really easy or i am just really stupid
PHP Rules

User avatar
gesf
Moderator
Moderator
Posts: 1716
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Mon Aug 08, 2005 5:46 pm

The easier the things, the more hard is for us to get there :D
Sincerely,
Gonçalo "gesf" Fontoura

gesf.org | sessionstart.com | urlms.com

Post Reply