problem checking value of POST variable

Posted on 2006-05-22
Medium Priority
Last Modified: 2008-03-06
I have a variable which is being posted into a page.

The variable came from a textbox.

All I want to do is check the value of the variable is valid.

code below:
                global $p_forename;
            if($p_forename ==  "" || "Enter Your First Name")
                  $p_forename = "Enter Your First Name";
                  $invalid = 1;

If I do an echo on $p_forename before the check it contains a value that should jump over this check.....

If the value is invalid a return to the page in which it was entered.

in this example i should be moving on but it keeps going back to the entry page and populating the forename textbox with "Enter Your First Name" which shouldnt be happening.

Can anyway see what im doing wrong.

Question by:scm0sml
LVL 49

Accepted Solution

Roonaan earned 1000 total points
ID: 16737273
if($p_forename == '' || $p_forename = 'enter Your First Name')

LVL 33

Assisted Solution

snoyes_jw earned 1000 total points
ID: 16737274
if($p_forename ==  "" || "Enter Your First Name")
should be
if($p_forename ==  "" || $p_forename == "Enter Your First Name")


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 18 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question