checkbox

Based on whether $isInFleet == 1, a string constituting a pre-checked checkbox is (or is not) assigned.

// Construct isInFleet checkbox control
if ( $isInFleet == "1" ) {
  $isInFleetBox =
    '  <div><input type="checkbox" name="isInFleet" id="isInFleet" value="1" checked="checked"/>' .
    '   <label for="isInFleet">Yes, this vehicle is in our company fleet.</label></div>';
} else {
  $isInFleetBox =
    '  <div><input type="checkbox" name="isInFleet" id="isInFleet" value="1"/>' .
    '   <label for="isInFleet">Yes, this vehicle is in our company fleet.</label></div>';
}
Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in Coding, PHP Form Fields and tagged , , . Bookmark the permalink.

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s