我正在一个 html 文档中尝试两个 form_open。提交第一个必须调用 saveInterview 动作,第二个必须调用 deleteInterview 动作。两种形式都有它们的form_close。但问题是提交第二个表单也会调用 saveInterview 操作而不是 deleteInterview 操作。视图代码如下
<div class="span8" align="right">
<a href="#EditInterview" role="button" class="btn btn-primary btn-large" data-toggle="modal">Edit</a> <br><br><br></div>
<div id="EditInterview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:950px;margin:0 0 0 -500px;">
<div class="modal-header">
<!-- <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button><br> -->
<h3 id="myModalLabel">Add new interview</h3>
</div>
<div class="modal-body">
<div id="addinterviewForm">
<p class="lead"><span class="label label-info">Anons title</span></p>
<?php
$interview_id = array(
'interview_id' => $interview->getId());
echo form_open_multipart('/InterviewController/saveInterview', '', $interview_id);
$anonstitle_date = array(
'name' => 'anonstitle',
'id' => 'anonstitle',
'maxlength' => '1000',
'value' => $interview->getAnonstitle(),
'rows' => '5',
'cols' => '122'
);?>
<span class="label label-info"> <?php echo form_textarea($anonstitle_date);?> </span>
<br><br><p class="lead"><span class="label label-info">Anons</span></p>
<?php
$anons_data = array(
'name' => 'anons',
'id' => 'anons_area',
'value' => $interview->getAnons()
);?>
<span class="label label-info"> <?php echo form_textarea($anons_data); ?> </span>
<br><br><p class="lead"><span class="label label-info">Anons image</span></p>
<span class="label label-info"> <?php echo form_upload('anonsphoto'); ?></span> <br /><br />
<p class="lead"><span class="label label-inverse">Interview title</span></p>
<?php
$interviewtitle_date = array(
'name' => 'interviewtitle',
'id' => 'interviewtitle',
'maxlength' => '1000',
'value' => $interview->getInterviewtitle(),
'rows' => '5',
'cols' => '122'
);?>
<span class="label label-inverse"> <?php echo form_textarea($interviewtitle_date);?> </span>
<p class="lead"><span class="label label-inverse">Interview</span></p>
<?php
$interview_data = array(
'name' => 'interview',
'id' => 'interview_area',
'value' => $interview->getInterview()
);?>
<span class="label label-inverse"> <?php echo form_textarea($interview_data); ?></span>
<br><br><p class="lead"><span class="label label-inverse">Interview image</span></p>
<span class="label label-inverse"><?php echo form_upload('interviewphoto'); ?> </span> <br /><br />
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-primary" type="submit">Save</button>
</div>
<?php form_close();?>
</div>
<script type="text/javascript">
CKEDITOR.replace( 'anons_area', { width: '900px', height: '200px' } );
CKEDITOR.replace( 'interview_area', { width: '900px', height: '200px' } );
</script>
<div class="span2" align="left">
<?php
echo form_open('/InterviewController/deleteInterview/' . $interview->getId());?>
<button class="btn btn-primary btn-large" type="submit">Delete</button>
<?php form_close();?>
</div>
<div class="span9">
<div align="center"><h3><?=$interview->getInterviewtitle()?></h3></div>
<img src='<?=$interview->getInterviewphoto()?>' align = "left" hspace ="20" vspace="20">
<p><?=$interview->getInterview()?></p>
</div>