例如,我知道您可以从“转到”,但是还有三分之一吗?
我正在制作一个$ form变量,我需要3级引号
$form = "<table id ='create_school_table'>
<tr>
<td>school name:</td>
<td><input type = 'text' maxlength='50' name='school_name' style='width: 174px;'/></td>
</tr>
<tr>
<td>state:</td>
<td><select name='state'>
<?php foreach ($states as $state) : ?>
//THIS NEXT LINE IS TRIPPING ME UP
<option value='<?php echo $state['state_name']; ?>'>
<?php echo $state['state_name']; ?>
</option>
<?php endforeach; ?>
</select></td>
</tr>
<tr>
<td></td>
<td><input type='button' value='add school' name='submitbtn' onclick='execute_add_school()' /></td>
</tr>
</table>"
最佳答案
您可以使用更多变量吗?
$form = "Your initial HTML";
$states = "";
foreach ($states as $state) {
$states .= "<option value='" . $state['state_name'] . "'>"
. $state['state_name'] . "</option>";
}
$form .= $states;
$form .= "the rest of your HTML";
如果您要明确地将所有内容都保留在一个变量中,请随时更新您的问题以反映这一点。
关于php - 如果您需要3个“层”的报价,该怎么办?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21541666/