在表格的每一行中,我都有一个“插入”链接。当用户单击此链接时,会出现一个包含表单的弹出窗口。当用户单击表单的“保存”按钮时,表单更新仅适用于父表的第一行。它只需要第一行ID。
SetLength(0)
我的控制器:
public class TestConnection {
static {
//for localhost testing only
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){
public boolean verify(String hostname,
javax.net.ssl.SSLSession sslSession) {
if (hostname.equals("localhost")) {
return true;
}
return false;
}
});
}
public static void main(String[] args)
{
HttpURLConnection urlConnection;
try {
//https get method with required parameters
// XMLHttpRequest s1 = new XMLHttpRequest ();
urlConnection = (HttpURLConnection) ((new URL("https://google.com").openConnection()));
urlConnection.setRequestMethod("GET");
urlConnection.setRequestProperty("User-Agent", "");
int HTTPS_RESPONSE_CODE = urlConnection.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(urlConnection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
String HTTPS_RESULT=response.toString();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at TestConnection.main(TestConnection.java:19)
查看页面:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</style>-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Popup contact form using only CSS - Demo | CodingCrazy</title>
<link href="<?php echo base_url();?>assets/css/styleform.css" rel="stylesheet" type="text/css"/>
<link href='http://fonts.googleapis.com/css?family=Electrolize' rel='stylesheet' type='text/css' />
<!--CC-->
<link rel="stylesheet" href="<?php echo base_url();?>assets/css/fonts.css"/>
</head>
</body>
</html>
<!--<link rel="stylesheet" href="<?php // echo base_url();?>assets/css/special.css" type="text/css" />-->
<div class="bal" style="margin-left: 627px;
padding: 15px;">
Balance Amount:<input type="text" name="bal">
<?php echo form_open('money_c/addrow')?>
<input type="submit" style="padding:7px;" name="sub" value="add row">
<?php echo form_close();?></div>
<table border="1">
<tr>
<th>Date</th>
<th>Description</th>
<th>Category</th>
<th>Debit</th>
<th>Credit</th>
<th>Bal.AMT</th>
<th>Insert</th>
<th> EDit/Delete</th></tr>
<?php foreach($query2 as $row)
{
$date=$row->date;
$desc=$row->description;
$credit=$row->credit;
$deb=$row->debit;
$bal=$row->bal;
$cat=$row->category;
$id=$row->id;
?>
<tr><td><?php echo $date;?></td>
<td><?php echo $desc;?></td>
<td><?php echo $credit;?></td>
<td><?php echo $deb;?></td>
<td><?php echo $bal;?></td>
<td><?php echo $cat;?></td>
<td><a href="#pop" >Insert<div id="pop" class="box">
<?php
?>
<!--<form action="" method="post" class="smart-green">-->
<div class="smart-green">
<?php
echo form_open('money_c/manualupdatesave/'.$id)?>///here updation happens only for first row id;
<h1>
<span>Please fill all the texts in the fields.</span>
</h1>
<label>
<span>Date:</span>
<input type="date" name="dat" />
</label>
<label>
<span>Description:</span>
<input name="desc" type="text" />
</label>
<label>
<span>Category:</span><select name="selection">
<?php foreach($query1 as $row1)
{
$cat=$row1->category;
?>
<!--<option value="Job Inquiry">Job Inquiry</option>-->
<option value="<?php echo $cat;?>"><?php echo$cat;?></option>
<?php
}
?>
</select>
</label>
<label>
<span>Debit:</span>
<input type="text" name="deb"></input>
</label>
<label>
<span>Credit:</span>
<input type="text" name="credit"></input>
</label>
<label>
<span> </span>
<input type="submit" style="margin-top:12px" class="button" style="background-color: #004e98;"value="Send" />
</label>
</div>
<?php echo form_close();?>
<!--</form>-->
<div id="close">
<td><a href="<?php echo site_url('money_c/manualdelete/'.$id);?>"><img src="<?php echo base_url();?>assets/images/del.jpg" width="60" height="40"></a></td>
</tr>
<?php
}
?></table>
</tbody>
</table>
:
money_c
function manualupdatesave($id)
{
$a=$this->input->post('dat');
$b=$this->input->post('desc');
$c=$this->input->post('cat');
$d=$this->input->post('deb');
$e=$this->input->post('credit');
$this->money_m->transaction($a,$b,$c,$d,$e,$id);
$this->load->view('header');
$result['query2'] = $this->money_m->selecttrans();
$this->load->view('manualupdate',$result);
$this->load->view('footer');
}
我的弹出窗体:
manualupdate.php