Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

if Statements

Featured Replies

Can any one explain the syntax for the use of "if" and "else" with php. An example would be to show on a php page a check box and text if a field in the database is no and show no check box and text if the field in the database is yes.

An example in my database is a client who receives prints with their new order (send_print field = yes) and another client who does not receive prints with a new order (sent_print field = no). For the client who does not automatically receive prints I would like the php to show a check box and some text. For the client who automatically receive prints I would like nothing to show on the php page.

Thanks in advance for your help - Sam

Howdy! I haven't tried FX.php yet, which I assume you're using, but here's kinda of what it would be like depending upon specifically what conditions you wanted to check (as stated, you probably need an IF... ELSE IF... but you can probably get away with just an IF... if the default is not to show anything if it's "yes", null, or other value.


<?

if ($send_print == "no")

{ 

print ("<input type='checkbox' name='mycheckboxname' value='yes'>some text");

}

?>





If you ever need to check the same variable for various values, a switch/case statement is good...





<? 

switch($send_print)

{

case "no":

print ("<input type='checkbox' name='mycheckboxname' value='yes'>some text");

break;



case "yes":

break;



default:

print ("This field should have either been YES or NO only.");

}

Hope this helps some...

--ST

  • Author

Thanks I will give it a try.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.