PHP Form not showing proper error message

Does anyone have any idea as to why this is showing the error message? I have tired empty and boolean test.


<p>You have nearly a full tank of fuel at <?php echo $intFuelGallons ?> gallons.</p>
    <p> Do you want to top off your tank?
        <input type="radio" name="TankTopOff" value="Yes" id="TankTopOff">
        <input type="radio" name="TankTopOff" value="No" id="TankTopOff">
    <p><?php echo $varWornTires ?> of your tires are worn. Do you want to replace any of them?</p>
      <input type="radio" name="TireReplace" value="Yes" id="TireReplace">
      <input type="radio" name="TireReplace" value="No" id="TireReplace">
 if ((($_POST['TankTopOff'])!=="No") || (($_POST['TankTopOff'])!=="Yes")) {
 $errorMessage .= "<li><h5>You forgot to choose if you want to top off your tank! " . ($_POST['TankTopOff']) . "</h5></li>";
 if ((($_POST['TireReplace'])!=="No") || (($_POST['TireReplace'])!=="Yes")) {
 $errorMessage .= "<li><h5>You forgot to choose if you want to replace any tires! ". ($_POST['TireReplace']) . "</h5></li>";




instead of

if ((($_POST['TankTopOff'])!=="No") || (($_POST['TankTopOff'])!=="Yes"))

and do the same with TireReplace

The boolean expression will never be false:

(($_POST['TankTopOff'])!=="No") || (($_POST['TankTopOff'])!=="Yes")

translates as EITHER the TankTopOff is something else than "No" OR TankTopOff is something else than "Yes"; which is always true.

Probably you just need to replace || with && (or even better - "and", if as suggested by some PHP framework developers).

Need Your Help

DllImport, Char*& and StringBuilder C/C#

c# dllimport stringbuilder

I have a problem, I tried to look at almost all the poster solutions, unsuccessful to find a suitable one.

Jquery Token Input not populating values from database, in ASP.NET MVC 3

jquery jquery-tokeninput

I am new to jQuery Token Input and am learning through this tutorial.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.