Jump to content

Garling

New Members
  • Posts

    3
  • Joined

  • Last visited

Garling's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ch0cu3r When I change my code to this, I am now getting an Internal Server Error unless I remove the php code.
  2. Barand, I am setting it so I can display Active and IN-Active instead of 0 and 1.
  3. I have a function that reads from a database and list to a webpage the results. What I want is to have the selected item on a list box show when a PHP variable is found, here is my code I have so far: <?php while ($row = db2_fetch_assoc($stmt)){ $WHMARK = $row['WHMARK']; $WHHOTEL = $row['WHHOTEL']; $WHSTATUS = $row['WHSTATUS']; if ($WHSTATUS == 1) { $Status = "Active"; } else{ $Status = "In-Active"; } echo '<tr>'; echo '<td>'.$WHMARK.'</td>'; echo '<td>'.$WHHOTEL.'</td>'; echo '<td>'.$Status.'</td>'; echo '<td>'; echo '<label>'; echo ' <select name="hotelActive" id="hotelActive">'; echo ' <option value="1"' <?php if($WHSTATUS == 1) ? 'selected="selected">';?>' echo '>Active</option>'; echo ' <option value="0"' <?php if($WHSTATUS == 0) ? 'selected="selected">';?>' echo '>In-Active</option>'; echo ' </select>'; echo '</label>'; echo '</td>'; echo '</tr>'; } ?> I need option value 1 selected if the variable '$Status' is 1 and option value 2 selected if the variable '$Status' is 2. This is PHP embedded in a HTML table.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.