对于一个问题的多个答案,如果我们可以通过form表单传递数组,那程序处理起来会简单多了:
- <table><br>
- <tr><br>
- <td><input type="checkbox" name="how_hear[]" id="how_hear1" value="Website" ></td><br>
- <td style="padding-left:3px"><label for="how_hear1">Website</label></td><br>
- </tr><br>
- <tr><br>
- <td><input type="checkbox" name="how_hear[]" id="how_hear2" value="TV Commercial" /></td><br>
- <td style="padding-left:3px"><label for="how_hear2">TV Commercial</label></td><br>
- </tr><br>
- <tr><br>
- <td><input type="checkbox" name="how_hear[]" id="how_hear3" value="Magazine Ad" /></td><br>
- <td style="padding-left:3px"><label for="how_hear3">Magazine Ad</label></td><br>
- </tr><br>
- </table><br>
- "[]"表示这个变量是一个数组,如果是PHP的话,可以这样获得这个数组$_POST['how_hear']。
|