|
 |
|
ช่วยดูcodeหน่อยครับ ทำไม่พอกดเพื่มช่องใน Firefox มันไม่ยอมเพื่มให้เหมือนในIE ครับ |
|
 |
|
|
 |
 |
|
ตอนนี้ผมแก้ให้ ใช้ กับ fire fox ได้เเล้วครับ เเต่ปัญหาต่อมาคือ จะบันทึกลง sql ยังไงอะครับ ผมลองเเล้วมันทำไม่ได้อะครับ
ผมแก้ตามกระทู้นี้อะครับ https://www.thaicreate.com/community/forum/025528.html
นี้ code ส่วนเลือกไฟร์ครับ
Code (PHP)
<script language="javascript">
function CreateNewRow()
{
var intLine = parseInt(document.frmMain.hdnMaxLine.value);
intLine++;
var theTable = document.all.tbExp
var newRow = theTable.insertRow(theTable.rows.length)
newRow.id = newRow.uniqueID
var item1 = 1
var newCell
//*** Column 1 ***//
newCell = newRow.insertCell(0)
newCell.id = newCell.uniqueID
newCell.setAttribute("className", "css-name");
newCell.innerHTML = "<center>"+intLine+"</center>"
//*** Column 2 ***//
newCell = newRow.insertCell(1)
newCell.id = newCell.uniqueID
newCell.setAttribute("className", "css-name");
newCell.innerHTML = "<center><INPUT TYPE=\"file\" SIZE=\"50\" NAME=\"fileUpload"+intLine+"\" VALUE=\"\"></center>"
document.frmMain.hdnMaxLine.value = intLine;
}
function RemoveRow()
{
intLine = parseInt(document.frmMain.hdnMaxLine.value);
if(parseInt(intLine) > 0)
{
theTable = (document.all) ? document.all.tbExp :
document.getElementById("tbExp")
theTableBody = theTable.tBodies[0];
theTableBody.deleteRow(intLine);
intLine--;
document.frmMain.hdnMaxLine.value = intLine;
}
}
</script>
<!--/////////////////////////////////////////////////////////////FORMรับข้อมูล///////////////////////////////////////////////////////////////-->
<form name="frmMain" method="post" action="add_image_project.php">
<div class="search_box curve">
<input name="btnAdd" type="button" id="btnAdd" value=" + " onClick="CreateNewRow();">
<input name="btnDel" type="button" id="btnDel" value=" - " onClick="RemoveRow();"> add ro remove
</div>
<div class="clear"> </div>
<table width="100%" class="my_table" id="tbExp">
<tr>
<td class="alt" width="20%"><div align="center">No.</div></td>
<td class="alt"><div align="center">File</div></td>
</tr>
</table>
<input type="hidden" name="hdnMaxLine" value="0">
<input type="submit" value="ส่ง">
</form>
<!--/////////////////////////////////////////////////////////////FORMรับข้อมูล///////////////////////////////////////////////////////////////-->
ส่วนนี้เป็นcode ที่ใช้บันทึกข้อมูลลงMY SQL ครับ
Code (PHP)
<?
$id_project=$_GET["id_project"];
mysql_connect("localhost","root","426226") or die (mysql_error());
mysql_select_db("webproject");
for($i=1;$i<=(int)($_POST["hdnMaxLine"]);$i++)
{
if($_FILES["fileUpload".$i]["name"] != "")
{
if(copy($_FILES["fileUpload".$i]["tmp_name"],"../image/project/".$_FILES["fileUpload".$i]["name"]))
{
$strSQL = "INSERT INTO project_image ";
$strSQL .="(Id_ep,Url_image) VALUES ('$id_project','".$_FILES["fileUpload".$i]["name"]."')";
mysql_query($strSQL);
echo "Copy/Upload ".$_FILES["fileUpload".$i]["name"]." completed.<br>";
}
}
}
echo "<br><a href='php_multiple_upload6.php'>View file</a>";
mysql_close();
?>
|
 |
 |
 |
 |
Date :
2012-01-14 18:10:27 |
By :
kissover |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Go to : Ajax CreateElement
ลองดัดแปลงจากตัวนี้ครับ แก้ไขบน FIrefox แล้ว 
|
 |
 |
 |
 |
Date :
2012-01-14 21:04:23 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
CDOE แบบ คห. No. 1 ของผมนั้นใช้ไม่ได้หรอครับ ผมติดเเค่add ลงsql อะ ทำอย่างไงก็ไม่ยอมลง
|
 |
 |
 |
 |
Date :
2012-01-14 21:53:53 |
By :
kissover |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตามที่ให้แหละครับ มันก็รับอย่างงั้นแหละครับ ผ่าน $_POST
|
 |
 |
 |
 |
Date :
2012-01-14 21:57:51 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยัง add ไม่เข้าอะครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
mysql_connect("localhost","root","426226") or die (mysql_error());
mysql_select_db("webproject");
for($i=1;$i<=(int)($_POST["hdnMaxLine"]);$i++)
{
if($_FILES["fileUpload".$i]["name"] != "")
{
if(move_uploaded_file($_FILES["fileUpload".$i]["tmp_name"],"image/project/".$_FILES["fileUpload".$i]["name"]))
{
$strSQL = "INSERT INTO project_image ";
$strSQL .="(Id_ep,Image) VALUES ('".$_GET["Id_ep"]."','".$_FILES["fileUpload".$i]["name"]."')";
mysql_query($strSQL);
echo "Copy/Upload ".$_FILES["fileUpload".$i]["name"]." completed.<br>";
}
}
}
echo "<br><a href='php_multiple_upload6.php'>View file</a>";
mysql_close();
?>
</body>
</html>
Code (PHP)
<html>
<head>
<title>Manga, Doujin, Novel online | hanes</title>
<meta http-equiv="content-language" content="th" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="description" content="ชุมชุนมังกะออนไลน์ โดจิน นิยาย" />
<meta name="keywords" content="hanes, มังกะออนไลน์, manga online, doujin, novel" />
<!-- CSS AND JS API -->
<link rel="stylesheet" href="../stylesheet/reset.css" type="text/css" media="all" />
<link rel="stylesheet" href="../stylesheet/neko_style.css" type="text/css" />
<link rel="stylesheet" href="../stylesheet/neko_index.css" type="text/css" />
<link rel="stylesheet" href="../stylesheet/user.css" type="text/css" />
<link rel="stylesheet" href="../stylesheet/awesome.css" type="text/css" />
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js'></script>
<!--[if lte IE 8]>
<script src="../js/html5.js" type="text/javascript"></script>
<![endif]-->
</head>
<script language="javascript">
function CreateNewRow()
{
var intLine = parseInt(document.frmMain.hdnMaxLine.value);
intLine++;
var theTable = document.all.tbExp
var newRow = theTable.insertRow(theTable.rows.length)
newRow.id = newRow.uniqueID
var item1 = 1
var newCell
//*** Column 1 ***//
newCell = newRow.insertCell(0)
newCell.id = newCell.uniqueID
newCell.setAttribute("className", "css-name");
newCell.innerHTML = "<center>"+intLine+"</center>"
//*** Column 2 ***//
newCell = newRow.insertCell(1)
newCell.id = newCell.uniqueID
newCell.setAttribute("className", "css-name");
newCell.innerHTML = "<center><INPUT TYPE=\"file\" SIZE=\"50\" NAME=\"fileUpload"+intLine+"\" VALUE=\"\"></center>"
document.frmMain.hdnMaxLine.value = intLine;
}
function RemoveRow()
{
intLine = parseInt(document.frmMain.hdnMaxLine.value);
if(parseInt(intLine) > 0)
{
theTable = (document.all) ? document.all.tbExp :
document.getElementById("tbExp")
theTableBody = theTable.tBodies[0];
theTableBody.deleteRow(intLine);
intLine--;
document.frmMain.hdnMaxLine.value = intLine;
}
}
</script>
<body>
<section class="box curve box_shadow">
<div class="hader"> </div>
<div class="clear"> </div>
<div class="post_box">
<!-- START MENU -->
<?php include('../nav.php'); ?>
<!-- END MENU -->
<!--START CHACK_LOGIN&OUT-->
<div class="user_panel">
<?php
//ถ้ามีตัวแปรเซสชั่น $_COOKIE["User"] แสดงว่าล็อกอินเรียบร้อยแล้ว
if (!isset($_SESSION["username"])) {
/* ใส่เนื้อหาอื่นๆที่ให้ดูได้เฉพาะผู้ที่ล็อกอินแล้ว */
echo '<li><a href="../login.php" class=" awesome small" title="login">Login</a> | <a href="../login.php" class=" awesome small" title="login">Register</a></li>';
}
else { //ยังไม่ได้ล็อกอิน
echo '<li class="li_login"><font class="font_user">You are [</font>'.$_SESSION["username"].'<font class="font_user">]</font> <a href="../logout.php" class=" awesome small" title="login">Logout</a></li>';
}
?>
</div>
<!--END CHACK_LOGIN&OUT-->
<div class="clear"> </div>
</section>
<div class="box_2">
<script>
$(document).ready(function(){
$("#box_project_info").hide();
$("#btn_box_project_info").click(function(e){
e.preventDefault();
$("#box_project_info").slideToggle();
});
});
</script>
<div class="content_box_2 curve bg_white box_shadow">
<h1>Manage Project</h1>
<div class="clear"> </div>
<br/>
<a class="awesome black medium" id="btn_box_project_info">Up Load Project</a>
<div id="box_project_info">
<form name="frmMain" method="post" action="add_image_project.php">
<div class="search_box curve">
<input name="btnAdd" type="button" id="btnAdd" value=" + " onClick="CreateNewRow();">
<input name="btnDel" type="button" id="btnDel" value=" - " onClick="RemoveRow();"> add ro remove
</div>
<div class="clear"> </div>
<table width="100%" class="my_table" id="tbExp">
<tr>
<td class="alt" width="20%"><div align="center">No.</div></td>
<td class="alt"><div align="center">File</div></td>
</tr>
</table>
<input type="hidden" name="hdnMaxLine" value="0">
<input type="submit" value="ส่ง">
</form>
</div>
<br/>
<br/>
<br/>
</div>
<div class="clear"> </div>
</div>
<!-- START FOOTER -->
<section class="box curve box_shadow">
<div class="left">
<b>About</b> | <b>FAQ</b> | <b>Contact</b><br /><small>Powered by Kissover</small>
</div>
<div class="right">
HANES.COM Since 2011<br/><small>Best view in 1280*700 and more. Good view in Google Chrome,Mozilla Firefox</small>
</div>
<div class="clear"> </div>
</section>
<!-- END FOOTER -->
</body>
</html>
|
ประวัติการแก้ไข 2012-01-15 00:06:37
 |
 |
 |
 |
Date :
2012-01-14 22:24:32 |
By :
kissover |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
for($i=1;$i<=(int)($_POST["hdnLine"]);$i++)
Code (PHP)
<input type="hidden" name="hdnMaxLine" value="0">
คุณจะไม่ดูค่าตัวแปรหน่อยเหรอครับ ว่าเหตุผลอะไรทำไมถึงไม่เข้า
|
 |
 |
 |
 |
Date :
2012-01-14 23:44:54 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$strSQL = "INSERT INTO project_image ";
$strSQL .="(Id_ep,Image) VALUES ('".$_GET["Id_ep".$i]."','".$_FILES["fileUpload".$i]["name"]."')";
mysql_query($strSQL);
echo "Copy/Upload ".$_FILES["fileUpload".$i]["name"]." completed.<br>";
นี่ด้วยครับ
|
 |
 |
 |
 |
Date :
2012-01-14 23:49:22 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ดูให้ดีก่อนถามครับ คนอื่่นเค้าไม่ค่อยจะมีเวลาไล่ดูให้คุณซะเท่าไหร่ครับ แล้วคุณจะต้องไม่ต้องมาถามซ้ำ ๆ ครับ
|
 |
 |
 |
 |
Date :
2012-01-14 23:54:14 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|