problem checking value of POST variable

Posted on 2006-05-22
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

    if($p_forename == '' || $p_forename = 'enter Your First Name')

    LVL 33

    Assisted Solution

    if($p_forename ==  "" || "Enter Your First Name")
    should be
    if($p_forename ==  "" || $p_forename == "Enter Your First Name")


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    The viewer will learn how to dynamically set the form action using jQuery.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now