Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2001
Posts: 184
Member
Member
Offline
Joined: Jan 2001
Posts: 184
Quote
quote:
Simply remove: $CustomField1 = $user_profile[20]

Your code set a variable and then checks to see if it equals nothing? Either move that line to the beginning to serve as a default if code later on sets it. Or, kill it as I suggest and let the if/else statements set it accordingly. It's the positioning that matters if your code is used (btw, add a semi-colon on the end of that 1st line).

I always advise setting a default at the beginning of source to compensate for any missing future file or user input errors/conditions. Later on, check for values and set conditionally. If no conditions are met, the value is the default. Your else condition essentially does that, so either method will work, but your method obviously cannot.

When you define defaults for variables, think ahead as to possible mistakes. The default should always be a "fallback" setting if literally, all else fails. You can even use defaults to see if other routines failed. Defaults are good, if used properly. But positioning is the key.

-Jim

Sponsored Links
Entire Thread
Subject Posted By Posted
CGI Assistance, Any and All help is Appreciated ! jzollo66 05/05/2001 4:46 PM
Re: CGI Assistance, Any and All help is Appreciated ! Dave_L 05/05/2001 5:10 PM
Re: CGI Assistance, Any and All help is Appreciated ! jzollo66 05/05/2001 5:37 PM
Re: CGI Assistance, Any and All help is Appreciated ! Dave_L 05/05/2001 5:50 PM
Re: CGI Assistance, Any and All help is Appreciated ! hate98 05/07/2001 6:05 PM
Re: CGI Assistance, Any and All help is Appreciated ! BassTeQ 05/08/2001 3:59 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)