0
제출 버튼을 클릭하면 행별로 모든 데이터 행을 표시합니다. 모두 잘 작동하지만 내 문제는 어떻게하면이 모든 값을 mysql 데이터베이스에 추가 할 수 있습니까? "submit_to_database "버튼을 누릅니다. 하나는 내 전체 코드 이것이 나에게데이터를 mysql 데이터베이스에 삽입하십시오
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<link rel="stylesheet" href="custom.css" type="text/css">
<html lang="en">
<head>
\t <meta charset="utf-8">
\t <title>Add Sales</title>
\t <script type="text/javascript">
\t function add_values(){
if(document.getElementById('edit_guid').value==""){
if(document.getElementById('stk').value!=""){
if(document.getElementById('stk').value!=0){
sell=document.getElementById('pric').value;
disc=document.getElementById('stk').value;
item=document.getElementById('guid').value;
roll=parseInt(document.getElementById('roll_no').value);
\t $('<tr id='+item+'><td><lable id='+item+'roll >'+roll+'</label></td><td><input type=text readonly="readonly" value='+sell+'></td><td><input type=text readonly="readonly" value='+disc+' ></td></tr>').fadeIn("slow").appendTo('#item_copy_final');
document.getElementById('stk').value="";
document.getElementById('pric').value="";
document.getElementById('roll_no').value=roll+1;
document.getElementById('guid').value=""; \t
}
}else{
alert('Please Select An Item');
}}}
</script>
<body>
\t \t \t \t <form name="form1" method="post" id="form1" action="">
<input type="hidden" id="roll_no" value="1" > \t
<div align="center">
<input type="hidden" id="guid">
<input type="hidden" id="edit_guid">
<table class="form" >
\t \t \t \t \t <tr>
<td>price</td> \t \t \t \t \t \t
<td>stk</td>
</tr>
\t \t \t <tr>
\t \t \t <td><input type='text' class='form-control' id="pric" name="pric"></td>
\t \t \t <td><input type='text' class='form-control' id="stk" name="stk"></td>
\t \t \t <td><input type="button" onclick="add_values()" id="add_new_code" value="submit" class="round"></div></form></td></tr>
</table>
\t \t \t \t <div style="overflow:auto ;max-height:300px; ">
<table class="form" id="item_copy_final" style="margin-left:45px "></table>
</div>
</div>
<div class="mytable_row ">
\t \t <form>
\t \t <div align="center">
\t \t <table>
\t \t <td><input type="button" value="submit_to_database" class="round"></td>
\t \t </table>
\t \t </div>
\t \t </form>
</body>
</html>
는의가/가르 칠 실수 위험한 코딩 관행을 전파하지 말자. 준비된 진술없이 응답을 게시하는 경우 [게시하기 전에 이것을 고려할 수 있습니다] (http://meta.stackoverflow.com/q/344703/). 또한 [더 가치있는 대답은 올바른 방법으로 OP를 보여주는 데서옵니다.] (https://meta.stackoverflow.com/a/290789/1011527) –
고맙습니다. 저를 위해서 고맙습니다. 고맙습니다. –