Form Submit on Company Editor and Room Editor
company editing:
On the client side, there are drop-down list and check box in the form:
<form action="company_rec.php" method="post" id="form-company">
<fieldset class="companyform">
<input name="action" type="hidden" value="edit" />
<input name="save" type="hidden" value="edit" />
<input name="save" type="hidden" value="edit" />
<input name="cmp_id" id="cmp_id" type="hidden" value="2" />
<table border="0">
<tr>
<td valign="top"><label>Rooms</label></td>
<td>
<table border="0">
<tr><th style="padding:0 5px;">Floor</th><th style="padding:0 5px;">Room</th></tr>
<tr><td style="padding:0 5px;">
<select name='floor_id' id='floor_id' style='min-width:50px'>
<option value="">No floor</option>
<option value='1' selected>G</option>
<option value='2' >P</option>
<option value='3' >3</option>
<option value='4' >4</option>
<option value='5' >5</option>
<!--....-->
</select>
</td>
<td style="padding:0 5px;">
<select name='room_id' id='room_id' style='min-width:50px'>
<option value="">No room</option>
<option value='1' >01</option>
<option value='2' >02</option>
<!--....-->
</select>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"><label>Name(English)</label></td>
<td><input name="eng_name" size="30" type="text" value="" /></td>
</tr>
<tr>
<td valign="top"><label>Name(Traditional Chinese)</label></td>
<td><input name="chi_name"size="30" type="text" value="華" /></td>
</tr>
<tr>
<td valign="top"><label>Description</label></td>
<td><textarea name="descp" rows="8" cols="15" class="tinymce xhedit"><p>G樓105室 / G/F Shop 105</p></textarea></td>
</tr>
<tr>
<td valign="top"><label>Amt of Strokes of 1st Traditional Chinese Char</label></td>
<td><input name="amt_stroke" class="inputbox" size="30" type="text" value="12" /></td>
</tr>
<tr>
<td valign="top"><label>Name(Simplified Chinese)</label></td>
<td><input name="schi_name" size="30" type="text" value="" /></td>
</tr>
<tr>
<td valign="top"><label>Description(Simplified Chinese)</label></td>
<td><textarea name="sdescp" rows="8" cols="15" class="tinymce xhedit"><p>G Shop 105</p></textarea></td>
</tr>
<tr>
<td valign="top"><label>Amt of Strokes of 1st Simplified Chinese Char</label></td>
<td><input name="samt_stroke"size="30" type="text" value="6" /></td>
</tr>
<tr>
<td valign="top"><label>是否啟用設備默認字體</label></td>
<td>
<select name="is_def_font">
<option value="1">YES</option>
<option value="0" selected>NO</option>
</select>
</td>
</tr>
<tr>
<td style="border:0"> </td><td style="border:0">
<button class="ui-button ui-widget ui-state-default ui-corner-all" οnclick="document.getElementById('form-company').submit();">
<span class="ui-icon ui-icon-disk"></span>Submit
</button>
</td>
</tr>
</table>
</fieldset>
</form>
We would change the field for ' is_def_font' from SELECT to CHECK BOX:
<td>
<input type="checkbox" value="1" name="is_def_font" class="checkbox"> <label for="cbdemo2">啟用</label>
</td>
And that won't cause any change on the server side code, here is a reference to check box in PHP.
http://note.ajneok.org/programing_note/php/php-get-checkbox/
http://www.html-form-guide.com/php-form/php-form-checkbox.html
On the server side, we still just use $_POST["is_def_font"] to get the string value from user submitting. Besides, plz note that, if the option of SELECT does not have value attribute set, the text will be got by PHP instead.