-2
即时创建一个调查系统使用PHP和MySQL ..这里的问题是我不知道如何通过'输入名称',当我点击提交按钮。从mysql输入名称
如:
1. Test 1
<input type="text" name="name_{=$res[$a]['id']}">
2. Test 2
<input type="text" name="name_{=$res[$a]['id']}">
如何称之为 '输入名称'?
if(isset($_post['btnSubmit'])) {
$xxx = $_post['name_????'];
$yyy = $_post['name_????'];
}
我替换{打开/关闭PHP的标签},因为它不允许..
编辑
<div class="form-body">
<h3 class="block"><?=$resSurvey[0]['survey_title']?></h3>
<p><?=$resSurvey[0]['survey_desc']?></p>
<br><br>
<?php
if ($rowQuestion >0) {
$bil=1;
for ($a=0; $a<$rowQuestion; $a++) {
?>
<div class="form-group">
<label class="control-label col-md-3"><?=$bil?>. <?=$resQuestion[$a]['question_title']?></label>
<?php if ($resQuestion[$a]['question_type'] == 'tf') { ?>
<div class="radio-list col-md-4" >
<label class="radio-inline"><input type="radio" name="name_<?=$resQuestion[$a]['question_id']?>" value="t"> True </label>
<label class="radio-inline"><input type="radio" name="name_<?=$resQuestion[$a]['question_id']?>" value="f"> False </label>
</div>
<?php } ?>
<?php if ($resQuestion[$a]['question_type'] == 'st') { ?>
<div class="col-md-4">
<input type="text" name="name_<?=$resQuestion[$a]['question_id']?>" class="form-control" placeholder="Enter text">
</div>
<?php } ?>
<?php if ($resQuestion[$a]['question_type'] == 'lt') { ?>
<div class="col-md-4">
<textarea class="form-control" name="name_<?=$resQuestion[$a]['question_id']?>" rows="3"></textarea>
</div>
<?php } ?>
<?php
if ($resQuestion[$a]['question_type'] == 'ms') {
$sqlOption = sprintf("select * from tbl_surveychoices where question_id=%d", mysql_real_escape_string($resQuestion[$a]['question_id']));
$resOption = selectSQL($sqlOption);
$rowOption = count($resOption);
?>
<div class="radio-list col-md-4">
<?php for($b=0; $b<$rowOption; $b++) { ?>
<label class="radio"><input type="radio" name="name_<?=$resQuestion[$a]['question_id']?>" value="<?=$resOption[$b]['choices_id']?>"> <?=$resOption[$b]['choices_title']?></label>
<?php } ?>
</div>
<?php } ?>
<?php
if ($resQuestion[$a]['question_type'] == 'mm') {
$sqlOption = sprintf("select * from tbl_surveychoices where question_id=%d", mysql_real_escape_string($resQuestion[$a]['question_id']));
$resOption = selectSQL($sqlOption);
$rowOption = count($resOption);
?>
<div class="radio-list col-md-4">
<?php for($b=0; $b<$rowOption; $b++) { ?>
<label><input type="checkbox" name="name_<?=$resQuestion[$a]['question_id']?>[]" value="<?=$resOption[$b]['choices_id']?>"> <?=$resOption[$b]['choices_title']?> </label>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
$bil++;
}
}
?>
</div>
我们应该怎么知道?我们不知道里面是什么$水库[$一] [ '身份证' ]。 – Neat 2015-01-15 17:28:49
你不帮忙@KoenHoeijmakers – achimet 2015-01-15 17:30:21
那么,也许提供给我们整个代码?,如果你不知道'$ res [$ a] ['id']'里面有什么,那么我们应该怎么知道? – Neat 2015-01-15 17:33:14