รบกวนช่วยดูโค๊ตให้หน่อยค่ะว่าทำไม submit form แล้วไม่มีข้อมูล
โค๊ตนะค่ะ
<% Option Explicit %>
<%
Function RandomNum(intLowerBound, intUpperBound)
Dim intRangeSize
Dim sngRandomValue
Dim intRandomInteger
If intLowerBound > intUpperBound Then
Dim iTemp
iTemp = intLowerBound
intLowerBound = intUpperBound
intUpperBound = iTemp
End If
Randomize()
intRangeSize = intUpperBound - intLowerBound + 1
sngRandomValue = intRangeSize * Rnd()
sngRandomValue = sngRandomValue + intLowerBound
intRandomInteger = Int(sngRandomValue)
RandomNum = intRandomInteger
End Function
dim rndNum
rndNum = RandomNum(10000, 99999)
Session.TimeOut = 60
Session("ssCustomer") = day(now) & Month(now) & Year(now) & rndNum
Session("code")= rndNum
Const strConnection = "database/LC_LINCHY.mdb"
Const strUserID = ""
Const strPassword = ""
Dim adoCon
Dim rs
Dim strSQL
dim str_type,str_Sale_or_Rent,image_id
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(strConnection)
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT LINCHY_IMAGE.LCI_IMA1, LINCHY_IMAGE.LCI_IMA2, LINCHY_IMAGE.LCI_IMA3, LINCHY_IMAGE.LCI_IMA4, LINCHY_IMAGE.LCI_IMA5, LINCHY_IMAGE.LCI_IMA6, LINCHY_IMAGE.LCI_ST FROM LINCHY_IMAGE;"
rs.CursorType = 2
rs.LockType = 3
rs.Open strSQL, adoCon
rs.AddNew
rs.Fields("LCI_IMA1") = "0"
rs.Fields("LCI_IMA2") = "0"
rs.Fields("LCI_IMA3") = "0"
rs.Fields("LCI_IMA4") = "0"
rs.Fields("LCI_IMA5") = "0"
rs.Fields("LCI_IMA6") = "0"
rs.Fields("LCI_ST") = Session("ssCustomer")
rs.Update
rs.Close
Set rs = Nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Post free property listing - Thailand Classified Ads</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="robots" content="index, follow">
<meta name="content-language" content="english">
<LINK href="style.css" type=text/css rel=stylesheet>
<SCRIPT src="bp.js" type=text/javascript></SCRIPT>
<script type="text/javascript">
var xmlhttpDP
function Inint_AJAXDP () {
var xmlhttpDP = false;
try {
xmlhttpDP = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
xmlhttpDP = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
xmlhttpDP = false;
}
}
if(!xmlhttpDP && document.createElement)
{
xmlhttpDP = new XMLHttpRequest();
}
return xmlhttpDP;
}
function startCallbackDP()
{
if (xmlhttpDP.readyState == 4)
{
if (xmlhttpDP.status == 200)
{
document.getElementById("timeDP").innerHTML=xmlhttpDP.responseText;
delete xmlhttpDP;
setTimeout("doStartDP()", 1000);
}
}
}
function doStartDP()
{
xmlhttpDP = Inint_AJAXDP();
var url = "detailImage.asp";
xmlhttpDP.open("GET", url, true);
xmlhttpDP.onreadystatechange = startCallbackDP;
xmlhttpDP.send(null);
}
function ShowReg(op) {
if (op == "0") {
document.getElementById('sale').style.display="none";
document.getElementById('Rental').style.display='none';
}
if (op == "1") {
document.getElementById('sale').style.display="block";
document.getElementById('Rental').style.display='none';
}
if (op == "2") {
document.getElementById('Rental').style.display="block";
document.getElementById('sale').style.display='none';
}
if (op == "3") {
document.getElementById('sale').style.display="block";
document.getElementById('Rental').style.display='block';
}
}
function ShowRoom(op) {
if (op == "1") {
document.getElementById('Room').style.display="block";
}
if (op == "2") {
document.getElementById('Room').style.display="block";
}
if (op == "3") {
document.getElementById('Room').style.display='none';
}
if (op == "4") {
document.getElementById('Room').style.display='none';
}
}
var MAXWIDTH = 150;
var MAXHEIGHT = 113;
function autosize(SENDER)
{
W = SENDER.width;
H = SENDER.height;
ratio = W/H;
ratioC = MAXWIDTH/MAXHEIGHT;
if(W>MAXWIDTH || H>MAXHEIGHT)
{
if(ratio>ratioC)
{
SENDER.width = MAXWIDTH;
}
else
{
SENDER.height = MAXHEIGHT;
}
SENDER.style.cursor = 'hand';
SENDER.onclick = function(){window.open(SENDER.src);};
}
}
function uploadok(pathfile)
{
document.getElementById('fileupload').value ="";
document.getElementById('upmsg').innerHTML = '<img src="'+pathfile+'" onload="autosize(this)">' ;
document.getElementById('t_img1').style.display="block";
document.getElementById('s_img1').style.display='none';
return true ;
}
function numberOnly( event )
{
var key = event.keyCode;
if ( !( ( key > 95 && key < 106 ) || key == 8 || key == 9 || key == 37 || key == 39 ) )
{
if ( window.event ) //IE
{
event.returnValue = null;
}
else //Firefox
{
event.preventDefault();
}
}
}
var MAXWIDTH = 150;
var MAXHEIGHT = 113;
function autosize(SENDER)
{
W = SENDER.width;
H = SENDER.height;
ratio = W/H;
ratioC = MAXWIDTH/MAXHEIGHT;
if(W>MAXWIDTH || H>MAXHEIGHT)
{
if(ratio>ratioC)
{
SENDER.width = MAXWIDTH;
}
else
{
SENDER.height = MAXHEIGHT;
}
SENDER.style.cursor = 'hand';
SENDER.onclick = function(){window.open(SENDER.src);};
}
}
function MM_openBrWindow(theURL,winName,features)
{
window.open(theURL,winName,features).focus();
}
</script>
</head>
<body>
<div align="center">
<!--#include file="header.asp" -->
<table width="1000" cellpadding="0" cellspacing=0>
<tr>
<!--#include file="leftmenu.asp" -->
<td bgcolor="#FFFFFF" align="left" width="800" valign="top" class="maintd">
<h1><strong>Post Ads</strong></h1>
<p>Fill in the form below to post ads</p>
<form name="postads" method="post" action="add_to_database_linchy.asp" encType="multipart/form-data" >
<div id="pp">
<table width="800" border="0" cellspacing="5" cellpadding="0" bgcolor="#FAF2E9">
<tr >
<td width="30%">
Property type:</td>
<td width="70%"><select name="Property_Type" onChange="ShowRoom(this.selectedIndex)">
<option value="0">--- Please Select ---</option>
<option value="1">Apartment/Condominium</option>
<option value="2">House</option>
<option value="3">Commercial Property</option>
<option value="4">Land</option>
</select>
</td>
</tr>
</table>
</div>
<div id="ow">
<table width="800" border="0" cellspacing="5" cellpadding="0">
<tr bgcolor="#FFFFFF">
<td width="30%">This property is for:</td>
<td width="70%">
<select name="Sale_or_Rent" id="choice" onChange="ShowReg(this.selectedIndex)">
<option value="0">--- Please Select ---</option>
<option value="1">Sale</option>
<option value="2">Rent</option>
<option value="3">Both: Sale and Rent</option>
</select>
</td>
</tr>
</table>
</div>
<div id="sale" style="display:''">
<table width="800" border="0" cellspacing="5" cellpadding="0" bgcolor="#FAF2E9">
<tr >
<td width="30%">Sale Price:</td>
<td width="70%">
<input type="text" name="Sale_Price" size="15" onkeydown="numberOnly(event)" >
</td>
</tr>
</table>
</div>
<div id="Rental" style="display:''">
<table width="800" border="0" cellspacing="5" cellpadding="0" >
<tr bgcolor="#FFFFFF">
<td width="30%">Rental Price:</td>
<td width="70%">
<input type="text" name="Rental_Price" size="15" onkeydown="numberOnly(event)">/month
</td>
</tr>
</table>
</div>
<div id="Room" style="display:''">
<table width="800" border="0" cellspacing="5" cellpadding="0" bgcolor="#FAF2E9">
<tr >
<td width="30%">Number of Bedrooms: </td>
<td width="70%">
<select name="Bedroom">
<option value="">--- Please Select ---</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">More than five</option>
</select>
<font size="2">Not available for property type: Land or Commercial</font>
</td>
</tr>
</table>
</div>
<div id="ll">
<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td width="30%">Property Location: </td>
<td width="70%">
<select name="Location">
<option value="">--- Please Select ---</option>
<option value="north">North: Chiang Mai & Region</option>
<option value="northeast">North East: Isaan Region</option>
<option value="central">Central: Bangkok & Region</option>
<option value="east">East Coast: Pattaya & Region</option>
<option value="west">West Coast: Hua Hin & Region</option>
<option value="islands">Islands: Samui & Region</option>
<option value="south">South: Phuket & Region</option>
</select>
</td>
</tr>
<tr bgcolor="#FAF2E9">
<td width="30%">Property Caption:</td>
<td width="70%">
<font size="2">This will appear as the explanatory title for your property ads. <BR>Example: Luxury condo for sale in Sukhumvit soi 20 - 2 million baht</font><BR>
<input type="text" name="Property_Caption" size="70" >
</td>
</tr>
<tr>
<td width="30%">Property Details:<BR><BR>
<font size="2">Enter any additional detail such as facilities, location, description, etc.</font><BR> </td>
<td width="70%">
<textarea name="Property_Details" cols="60" rows="10" ></textarea>
</td>
</tr>
</table>
</div>
<div id="ddff">
<table width="800" border="0" cellspacing="5" cellpadding="0" bgcolor="#FAF2E9">
<tr >
<td width="30%">Upload Image:</td>
<td width="70%"><div id="timeDP"> </div>
<script language=JavaScript>doStartDP();</script>
</td>
</tr>
</table>
</div>
<div id="dsff">
<table width="800" border="0" cellspacing="5" cellpadding="0">
<tr >
<td width="30%">Your Name:</td>
<td width="70%">
<input type="text" name="Your_Name" size="40" >
</td>
</tr>
<tr bgcolor="#FAF2E9">
<td width="30%">Your Email Address:</td>
<td width="70%">
<input type="text" name="Your_Email" size="40" >
</td>
</tr>
<tr >
<td width="30%">Your Phone Number:</td>
<td width="70%">
<input type="text" name="Your_Phone_Number" size="40" >
</td>
</tr>
<tr bgcolor="#FAF2E9">
<td >Your Website:</td>
<td>
<input type="text" name="Your_Website" size="40" >
</td>
</tr>
<tr >
<td>Password:</td>
<td>
<font size="2">This password is needed to edit or delete your listing in the future.</font><BR>
<input type="text" name="Password" size="10" >
</td>
</tr>
<tr bgcolor="#FAF2E9">
<td>Ads will expire in:</td>
<td>
<select name="Ads_Expiry">
<option value="7">7 days</option>
<option value="15">15 days</option>
<option value="30">30 days</option>
<option value="45">45 days</option>
<option value="60">60 days</option>
</select>
</td>
</tr>
<tr>
<td valign="top">Verfication Number:</td>
<td>
<font size="2">Enter the number below exactly as you see it (to avoid spam)</font><BR>
<img src="images/verify.gif" border="0" alt=""><BR>
<input size="3" name="Verification_Number"></td>
</tr>
<tr align="left" valign="middle">
<td></td>
<td>
<input type="submit" name="Submit2" value="Send" onClick="MM_validateForm('NAME','','R','EMAIL','','RisEmail','MESSAGE','','R');return document.MM_returnValue"> </td>
</tr>
</table>
</div>
</form>
</td>
</tr>
<!--#include file="footer.asp" -->
</div>
</body>
</html>
งงมาก ๆ ค่ะTag : - - - -
Date :
2009-08-03 16:44:19
By :
kookkik
View :
1418
Reply :
5
โฮ ยาวมากครับ ช่วยลำบากจริง ๆ ครับ
Date :
2009-08-03 17:28:12
By :
webmaster
ไม่ไหวครับ ยาวเกิน เอาส่วนที่สำคัญมาดีกว่าครับ อาจช่วยได้
Date :
2009-08-03 22:46:06
By :
ชล
ขอบคุณค่ะ
ได้แล้ว ค่ะ
ที่ให้ยาว ๆ เพราะไม่รู้ว่าส่วนไหนทำให้ post ไม่ได้ -*-
แก้ไปแก้มาอยู่หลายหน
แต่แล้วก็พบว่าเป็นที่
<form name="postads" method="post" action="add_to_database_linchy.asp" encType="multipart/form-data" >
encType="multipart/form-data" ตัวนี้ละค่ะ (ไม่ทราบเหมือนกันว่าทำมัย)
พอตัดออก ข้อมูลที่ไปเป็นค่าว่าง ทำให้ error เข้าฐานข้อมูลไม่ได้
เลยเขียน ดักไว้ ก็ได้แล้วค่ะ
บอกไว้เพื่อคนที่เจอเหมือนกันค่ะ
เขียน php มาเจอ asp เลยงงไปเลยค่ะ
ขอบคุณท่านที่ต้องการช่วยมาก ๆ ค่ะ
Date :
2009-08-04 00:38:40
By :
kookkik
encType="multipart/form-data" ตัวนี้ละค่ะ
มันเป็นการส่งข้อมูลแบบไบนารี น่ะครับ ใช้เวลาupload รูปภาพมากกว่า
Date :
2009-08-14 13:30:21
By :
worwear
เวลาจะส่งรูป ต้อง เพิ่ม enctype="multipart/form-data" ใน tag form ครับ
Date :
2009-08-14 16:37:59
By :
Sek-Artdrinker
Load balance : Server 02