我在我的应用程序中创建了一个表单...每当用户刷新浏览器时...存储在数据库中的表单空值...以及每次刷新浏览器时邮件也会发送给特定的人。
以下是我的观点:
<form action="" id="form" method="post" >
<div class="form-group">
<div class="form-group">
<label>Select</label>
<select class="form-control" name="selection">
<option>Telephonic</option>
<option>F2F</option>
<option>HR</option>
</select>
</div>
<div class="box-body pad">
<label>Comments</label>
<textarea class="textarea" name="comments" id="Comments "placeholder="Place comments here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
</div>
<div class="box-body pad">
<label>Results</label>
<textarea class="textarea" name="results" placeholder="Place results here" style="width: 100%; height: 200px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
</div>
<div class="form-group">
<label>
<input type="radio" name="selection_process" value="1" class="flat-red" checked>Selected
</label>
<label>
<input type="radio" name="selection_process" value="2" class="flat-red">Not Selected
</label>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
</div>
</div>
<div class="col-xs-4">
<button type="submit" name="submit" id="submit"class="btn btn-primary btn-block btn-flat">Submit</button>
</div>
</div>
</div>
</form>
这是我的控制者:
<?php
public function add_selection()
{
$data=array(
'selection'=>$this->input->post('selection'),
'comments'=>$this->input->post('comments'),
'results'=>$this->input->post('results'),
'selection_process'=>$this->input->post('selection_process')
);
if($data['selection_process']==1)
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => 'test3@clozloop.com',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('test3@clozloop.com', 'bharathi');
$list=array('nalamalapu.bharathi@gmail.com','bharathi.nalamalapu@gmail.com');
$this->email->to($list);
$this->email->subject('YOU ARE SELECTED');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
$this->email->send();
}
else
{
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://md-in-42.webhostbox.net',
'smtp_port' => 465,
'smtp_user' => 'test3@clozloop.com',
'smtp_pass' => 'test3'
);
$this->load->library('email',$config);
$this->email->set_mailtype("html");
$this->email->from('test3@clozloop.com', 'bharathi');
$list=array('nalamalapu.bharathi@gmail.com','bharathi.nalamalapu@gmail.com','mounikavemula537@gmail.com');
$this->email->to($list);
$this->email->subject('YOU ARE NOT SELECTED');
$link = 'Click on this link - <a href="http://localhost/job_portal/index.php/Login/signin">Click Here</a>';
$this->email->message($link);
$this->email->send();
}
$this->SelectionModel->add_selection_details($data);
$this->load->view('selection/selection_details',$data);
}
?>
请帮我怎么做.. 谢谢..
答案 0 :(得分:0)
提供表单操作controller / functionName
将此行更改为
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.microsoft.pdfviewertestapplication/com.microsoft.pdfviewertestapplication.MainActivity}: java.lang.IllegalStateException: DialogFragment can not be attached to a container view
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4077)
at android.app.ActivityThread.-wrap15(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1350)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
到
<button type="submit" name="submit" id="submit"class="btn btn-primary btn-block btn-flat">Submit</button>
并在控制器中添加此条件
<input type="submit" name="submit" id="submit"class="btn btn-primary btn-block btn-flat" value="submit"/>
或者使用表单验证来检查表单是否有效 在此重定向到页面或重新加载页面之后
答案 1 :(得分:0)
使用POST数据的问题是刷新时浏览器会重新发送POST信息,这就是为什么很多人使用js / ajax发送这种东西..我建议看看如何通过这种方法来做或者在控制器和模型中建立代码验证,以确保不允许空值(未设置的变量)。
让页面重新发布回来是一种很好的方法。
<form action="[insert the method/view here]" id="form" method="post" >