[Risolto] Form non invia a db access caratteri accentati

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Salve a tutti,
Dopo tante ricerche senza soluzione, chiedo il vostro aiuto.
Ho un form in asp che invia i dati a un database access, su server Aruba,
il problema è che quando inserisco nel form caratteri accentati tipo: ( è à ò ù ì ) nel db aprendolo offline mi ritrovo questo �����.

Ho provato in tutti i modi, con i ( content="text/html; charset=ISO-8859-1")
con Session.Codepage=65001

ma nulla!!
potete aiutarmi? grazie
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
550
13
18
Italy
www.riciclarte.info
Salve a tutti,
...Ho provato in tutti i modi, con i ( content="text/html; charset=ISO-8859-1")
con Session.Codepage=65001

Prova così:
Codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

...nella pagina che effettua materialmente l'inserimento dei dati nel DB.
Paolo
 
Ultima modifica:

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Ciao Paolo
grazie per la risposta!
ho inserito quanto mi hai mandato, ma mi restituisce errore

Active Server Pages error 'ASP 0140'

Page Command Out Of Order

/bacheca_an/inc_place.asp, line 1

The @ command must be the first command within the Active Server Page.

se vuoi posto tutto il codice della pagina, così la controlli tu, perchè io veramente non so più dove guardare!!
 
Ultima modifica:

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Ecco il codice che secondo me dovrebbe far tutto, nello stesso codice si trova il form e l'invio nel db.
in rosso ho messo quello che secondo me dovrebbe essere l'invio al db.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<!--#include file="Connections/connDUclassified.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>


<!--#include file="ScriptLibrary/incPureUpload.asp" -->

<%
'*** Pure ASP File Upload 2.1.7
Dim GP_uploadAction,UploadQueryString
PureUploadSetup
If (CStr(Request.QueryString("GP_upload")) <> "") Then
Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
pau_thePath = """../public/immagini_bacheca"""
pau_Extensions = "GIF,JPG,JPEG,BMP,PNG"
pau_Form = "NEW"
pau_Redirect = ""
pau_storeType = "file"
pau_sizeLimit = ""
pau_nameConflict = "uniq"
pau_requireUpload = "false"
pau_minWidth = ""
pau_minHeight = ""
pau_maxWidth = ""
pau_maxHeight = ""
pau_saveWidth = ""
pau_saveHeight = ""
pau_timeout = "600"
pau_progressBar = ""
pau_progressWidth = "300"
pau_progressHeight = "100"

Dim RequestBin, UploadRequest
CheckPureUploadVersion 2.17
ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (UploadQueryString <> "") Then
MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_insert")) = "NEW") Then
Session.Codepage=65001
MM_editConnection = MM_connDUclassified_STRING
MM_editTable = "ADS"
MM_editRedirectUrl = "ads.asp"
MM_fieldsStr = "AD_TYPE|value|AD_TITLE|value|AD_EXPIRED|value|AD_QUANTITY|value|AD_PRICE|value|AD_LINK|value|AD_IMAGE|value|AD_DESCRIPTION|value"
MM_columnsStr = "AD_TYPE|none,none,NULL|AD_TITLE|',none,''|AD_EXPIRED|',none,NULL|AD_QUANTITY|none,none,NULL|AD_PRICE|none,none,NULL|AD_LINK|',none,''|AD_IMAGE|',none,''|AD_DESCRIPTION|',none,''"


' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(UploadFormRequest(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(UploadFormRequest("MM_insert")) <> "") Then
Session.Codepage=65001
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ", AD_POSTER) values (" & MM_dbValues & ", '" & Session("MM_Username") & "')"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%

set rsCat = Server.CreateObject("ADODB.Recordset")
rsCat.ActiveConnection = MM_connDUclassified_STRING
rsCat.Source = "SELECT * FROM TYPES ORDER BY TYPE_NAME ASC"
rsCat.CursorType = 0
rsCat.CursorLocation = 2
rsCat.LockType = 3
rsCat.Open()
rsCat_numRows = 0
%>
<link href="assets/DUclassified.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}

//-->

</script>
</head>
</html>

<script language="javascript" src="ScriptLibrary/incPureUpload.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<table width="100%" border="0" cellspacing="2" cellpadding="2">

<tr>


<td align="center" valign="middle"> <form ACTION="<%=MM_editAction%>" METHOD="post" enctype="multipart/form-data" name="NEW" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','');return document.MM_returnValue">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><table align="center" cellpadding="3" cellspacing="3">
<tr align="left" valign="middle">
<td colspan="2" nowrap class="textBold">Per inserire un nuovo
annuncio, compila il modulo qui sotto.</td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="textBold">
CATEGORIA:</td>
<td valign="middle"> <select class = "form" name="AD_TYPE">
<%
While (NOT rsCat.EOF)
%>
<option value="<%=(rsCat.Fields.Item("TYPE_ID").Value)%>"><%=(rsCat.Fields.Item("TYPE_NAME").Value)%></option>
<%
rsCat.MoveNext()
Wend
If (rsCat.CursorType > 0) Then
rsCat.MoveFirst
Else
rsCat.Requery
End If
%>
</select> </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">TITOLO:</td>
<td> <input name="AD_TITLE" type="text" class="form" value="" size="50" maxlength="50">
</td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">NOME:</td>
<td class="textBold">
<%= Session("MM_Username") %> </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">DURATA:</td>
<td class="textGray"> <select name="AD_EXPIRED" class="form" id="AD_EXPIRED">
<option value="<%= date+30 %>" selected>30 days</option>
<option value="<%= date+60 %>">60 days</option>
<option value="<%= date+90 %>">90 days</option>
</select></td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">QUANTITA':</td>
<td class="textGray"> <input name="AD_QUANTITY" type="text" class="form" value="" size="5" maxlength="5">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">PREZZO:</td>
<td class="textGray"> <input name="AD_PRICE" type="text" class="form" value="" size="15">
(Optional)</td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">URL SITO:</td>
<td class="textGray"> <input name="AD_LINK" type="text" class="form" value="http://www." size="60">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">IMMAGINE:</td>
<td class="textGray"> <input name="AD_IMAGE" type="file" class="form" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','')" size="35">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" valign="top" nowrap class="textBold">
DESCRIZIONE:</td>
<td> <textarea name="AD_DESCRIPTION" cols="70" rows="12" class="form" lang="it"></textarea>
</td>
</tr>
<tr valign="middle">
<td nowrap align="right">i</td>
<td> <input name="submit" type="submit" class="form" onClick="MM_validateForm('AD_TITLE','','R','AD_QUANTITY','','NisNum','AD_PRICE','','NisNum','AD_DESCRIPTION','','R');return document.MM_returnValue" value="Submit Ad">
</td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="NEW">
</form></td>
</tr>
<tr>
<td align="right" valign="middle" class="text">Powered by <a href="http://www.atuttaneve.it" target="_blank">
A Tutta Neve</a></td>
</tr>
</table>
</head>
</html>
<%
rsCat.Close()
%>
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
550
13
18
Italy
www.riciclarte.info
Ciao Paolo
grazie per la risposta!
ho inserito quanto mi hai mandato, ma mi restituisce errore

Active Server Pages error 'ASP 0140'

Page Command Out Of Order

/bacheca_an/inc_place.asp, line 1

The @ command must be the first command within the Active Server Page.

se vuoi posto tutto il codice della pagina, così la controlli tu, perchè io veramente non so più dove guardare!!

Ciao Fabius,
ho riletto con calma l'errore, in pratica il problema è nel file inc_place.asp linea 1, hai duplicato il comando <%@LANGUAGE="VBSCRIPT" %>
Controlla e riprova.
 

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Ciao
ho fatto quanto mi hai detto! adesso l'errore non lo rilancia più! avevo duplicato il comando @ nella pagina che richiama l'include inc_place.asp

Invece il problema dell'invio di caratteri accentati non è risolto.
Nel db mi ritrovo ancora i solti simboli, ����

:crying::crying:
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
550
13
18
Italy
www.riciclarte.info
...non ti preoccupare, bisogna solo smanettarci un po, intanto ti ripropongo il tuo codice con qualche modifica:

Codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="assets/DUclassified.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}
//-->
</script>
<script language="javascript" src="ScriptLibrary/incPureUpload.js"></script>
</head>
<!--#include file="Connections/connDUclassified.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthor ization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload 2.1.7
Dim GP_uploadAction,UploadQueryString, PureUploadSetup
If (CStr(Request.QueryString("GP_upload")) <> "") Then

		Dim pau_thePath, pau_Extensions, pau_Form, pau_Redirect, pau_storeType, pau_sizeLimit, pau_nameConflict, pau_requireUpload, pau_minWidth, pau_minHeight, pau_maxWidth, pau_maxHeight, pau_saveWidth, pau_saveHeight, pau_timeout, pau_progressBar, pau_progressWidth, pau_progr essHeight
		
		
				pau_thePath = """../public/immagini_bacheca"""
				pau_Extensions = "GIF,JPG,JPEG,BMP,PNG"
				pau_Form = "NEW"
				pau_Redirect = ""
				pau_storeType = "file"
				pau_sizeLimit = ""
				pau_nameConflict = "uniq"
				pau_requireUpload = "false"
				pau_minWidth = ""
				pau_minHeight = ""
				pau_maxWidth = ""
				pau_maxHeight = ""
				pau_saveWidth = ""
				pau_saveHeight = ""
				pau_timeout = "600"
				pau_progressBar = ""
				pau_progressWidth = "300"
				pau_progressHeight = "100"
		
		
		Dim RequestBin, UploadRequest
		'CheckPureUploadVersion 2.17
		'ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeT ype,pau_sizeLimit,pau_nameConflict,pau_requireUplo ad,pau_minWidth,pau_minHeight,pau_maxWidth,pau_max Height,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (UploadQueryString <> "") Then
MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_insert")) = "NEW") Then
'Session.Codepage=65001
MM_editConnection = MM_connDUclassified_STRING
MM_editTable = "ADS"
MM_editRedirectUrl = "ads.asp"
MM_fieldsStr = "AD_TYPE|value|AD_TITLE|value|AD_EXPIRED|value|AD_ QUANTITY|value|AD_PRICE|value|AD_LINK|value|AD_IMA GE|value|AD_DESCRIPTION|value"
MM_columnsStr = "AD_TYPE|none,none,NULL|AD_TITLE|',none,''|AD_EXPI RED|',none,NULL|AD_QUANTITY|none,none,NULL|AD_PRIC E|none,none,NULL|AD_LINK|',none,''|AD_IMAGE|',none ,''|AD_DESCRIPTION|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(UploadFormRequest(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(UploadFormRequest("MM_insert")) <> "") Then
'Session.Codepage=65001
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ", AD_POSTER) values (" & MM_dbValues & ", '" & Session("MM_Username") & "')"

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%

set rsCat = Server.CreateObject("ADODB.Recordset")
rsCat.ActiveConnection = MM_connDUclassified_STRING
rsCat.Source = "SELECT * FROM TYPES ORDER BY TYPE_NAME ASC"
rsCat.CursorType = 0
rsCat.CursorLocation = 2
rsCat.LockType = 3
rsCat.Open()
rsCat_numRows = 0

%>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center" valign="middle"> <form ACTION="<%=MM_editAction%>" METHOD="post" enctype="multipart/form-data" name="NEW" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,P NG',false,'','','','','','','');return document.MM_returnValue">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#666666">
<tr>
<td align="left" valign="top" bgcolor="#FFFFFF"><table align="center" cellpadding="3" cellspacing="3">
<tr align="left" valign="middle">
<td colspan="2" nowrap class="textBold">Per inserire un nuovo
annuncio, compila il modulo qui sotto.</td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="textBold">
CATEGORIA:</td>
<td valign="middle"> <select class = "form" name="AD_TYPE">
<%
While (NOT rsCat.EOF)
%>
<option value="<%=(rsCat.Fields.Item("TYPE_ID").Value)%>"> <%=(rsCat.Fields.Item("TYPE_NAME").Value)%></option>
<%
rsCat.MoveNext()
Wend
If (rsCat.CursorType > 0) Then
rsCat.MoveFirst
Else
rsCat.Requery
End If
%>
</select> </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">TITOLO:</td>
<td> <input name="AD_TITLE" type="text" class="form" value="" size="50" maxlength="50">
</td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">NOME:</td>
<td class="textBold">
<%= Session("MM_Username") %> </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">DURATA:</td>
<td class="textGray"> <select name="AD_EXPIRED" class="form" id="AD_EXPIRED">
<option value="<%= date+30 %>" selected>30 days</option>
<option value="<%= date+60 %>">60 days</option>
<option value="<%= date+90 %>">90 days</option>
</select></td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">QUANTITA':</td>
<td class="textGray"> <input name="AD_QUANTITY" type="text" class="form" value="" size="5" maxlength="5">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">PREZZO:</td>
<td class="textGray"> <input name="AD_PRICE" type="text" class="form" value="" size="15">
(Optional)</td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">URL SITO:</td>
<td class="textGray"> <input name="AD_LINK" type="text" class="form" value="http://www." size="60">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" nowrap class="textBold">IMMAGINE:</td>
<td class="textGray"> <input name="AD_IMAGE" type="file" class="form" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BM P,PNG',false,'','','','','','','')" size="35">
(Optional) </td>
</tr>
<tr valign="middle">
<td align="right" valign="top" nowrap class="textBold">
DESCRIZIONE:</td>
<td> <textarea name="AD_DESCRIPTION" cols="70" rows="12" class="form" lang="it"></textarea>
</td>
</tr>
<tr valign="middle">
<td nowrap align="right">i</td>
<td> <input name="submit" type="submit" class="form" onClick="MM_validateForm('AD_TITLE','','R','AD_QUA NTITY','','NisNum','AD_PRICE','','NisNum','AD_DESC RIPTION','','R');return document.MM_returnValue" value="Submit Ad">
</td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="NEW">
</form></td>
</tr>
<tr>
<td align="right" valign="middle" class="text">Powered by <a href="http://www.atuttaneve.it" target="_blank">
A Tutta Neve</a></td>
</tr>
</table>
</head>
</html>
<%
rsCat.Close()
%>

...ovviamente non posso provarlo perchè mi mancano gli include ed i DB

Leggi questa discussione: http://forum.mrwebmaster.it/asp/29023-ortografia-annunci.html

Oppure anche questa: http://forum.mrwebmaster.it/asp/21922-caratteri-accentati.html
 
Ultima modifica:

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Ciao Paolo!
innanzi tutto grazie mille per il tempo che mi dedichi,
nulla da fare, il codice che mi hai mandato non invia il form al db.

come posso fare ad inviarti i file che mancano?
 

Paolo69

Moderatore
Membro dello Staff
MOD
18 Feb 2010
550
13
18
Italy
www.riciclarte.info
...basta!!! se non smetto divento matto.
...allora, non ne sono venuto a capo ma penso che il problema sta nel fatto che nel form utilizzi "enctype="multipart/form-data"" per poter fare l'upload del file.

L'utilizzo di tale formato non passa tutti i caratteri e pertanto non vengono inseriti nel DB.

Codice:
<form ACTION="<%=MM_editAction%>" METHOD="post" enctype="multipart/form-data" name="NEW" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',false,'','','','','','','');return document.MM_returnValue">

Tratto da una ricerca internet:
The content type "application/x-www-form-urlencoded" is inefficient for
sending large quantities of binary data or text containing non-ASCII
characters. The content type "multipart/form-data" should be used for
submitting forms that contain files, non-ASCII data, and binary data.The
content type "application/x-www-form-urlencoded" is inefficient for sending
large quantities of binary data or text containing non-ASCII characters. The
content type "multipart/form-data" should be used for submitting forms that
contain files, non-ASCII data, and binary data.

In poche parole o fai un annuncio che procede a step... in pratica prima fai inserire il testo e poi permetti l'upload di immagini o file o altrimenti non so che dirti.

Paolo
 

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
eheheh anche io sono diventato matto!!
mi ero soffermato anche io sul metodo multipart/form-data, perchè vedendo altri form non lo utilizzano e funzionano.

domanda secondo te si può cambiare il metodo utilizzando method="post" anzichè multipart/form-data ?
 

fabiusRiders

Nuovo Utente
23 Gen 2011
26
0
0
www.ridersitalia.it
Ciao Paolo,
alla fine ho fatto come mi ha suggerito..
ho creato prima il form con l'invio dei dati testo, poi con un secondo form faccio l'upload, sembra funzionare tutto,
certo è più macchinoso cosi, però almeno ho risolto.

grazie ancora
 
Discussioni simili
Autore Titolo Forum Risposte Data
F [Risolto] Form di modifica record non riconosce <br> db access Classic ASP 3
F [Risolto] Form non invia a db access caratteri accentati Classic ASP 1
A [Javascript] [RISOLTO] Doppio "submit", in uno stesso "Form" , che puntino ad "action" diversi Javascript 1
A [PHP] [RISOLTO]Compilazione campi form da record db PHP 3
A [PHP] [RISOLTO] Modifica record db da form PHP 11
M [risolto] Script ajax per form e mappe Ajax 6
F [RISOLTO]Php form select PHP 9
Virginia86 [risolto] Problema select e verifica form PHP 38
T [risolto] aiutino modifica form email HTML e CSS 7
T [risolto] Realizzare un form email con multi scelta Sviluppo app per Android 2
H [risolto] Controlli form iscrizione PHP 16
H [RISOLTO]Quesito form Javascript 5
S [RISOLTO]invio form con select onchange Javascript 2
L (risolto) MySQL 0
B getElementById su piu id(Risolto) Javascript 6
L Esercitarsi con Js [RISOLTO] Javascript 4
C [RISOLTO]Inserimento variabile php in input html PHP 20
L risolto visualizzazione e ordinamento dati PHP 1
moustache [RISOLTO] SQL PHP IIS PHP 8
Sergio Unia Ricezione email con destinatari multipli [Risolto] PHP 2
L update tabelle in php mysql [risolto] PHP 6
M Semplice visualizzatore di immagini [risolto con plugin wp] PHP 7
L [RISOLTO] Stampa a video risultato count in html PHP 13
L [RISOLTO] Eliminare una discussione creata PHP 3
tomorc [HTML] Problema con scroll bar (risolto) HTML e CSS 0
A [PHP] Problema query insert [RISOLTO] PHP 14
B [PHP] recuperare IP dei server in load balancing [RISOLTO] PHP 3
K [RISOLTO] Problema Griglia Php+Mysql PHP 13
S [RISOLTO] aggiorna tabella da select option asp classic Classic ASP 7
elpirata [RISOLTO][Javascript] Datapicker e autocompletamento campo input Javascript 2
elpirata [RISOLTO][Mysql] Problema insert valori apostrofati MySQL 1
elpirata [RISOLTO][Mysql] Contare le occorrenze in un campo tipo varchar MySQL 2
G [MS Access] Gestione biglietti [RISOLTO] MS Access 2
G [MS Access] Casella combinata & Query [RISOLTO] MS Access 4
G [MS Access] Query mese corrente con conteggio [RISOLTO] MS Access 2
M [RISOLTO]Windows media player non mi funziona più su win 10 pro 64 bit Windows e Software 2
C [RISOLTO][PHP] Errore di sintassi PHP 8
IT9-Gpp [RISOLTO] Leggere variabile restituita da success Ajax 3
Kolop [RISOLTO][PHP] Problema Pagination PHP 2
C [RISOLTO][PHP] Funzione ONclick PHP 14
C [RISOLTO][PHP] Conteggio righe di una tabella PHP 4
N [PHP] Utilizzo variabili di sessione [Risolto] PHP 13
Tommy03 [RISOLTO][PHP] Webserver o devserver? PHP 2
Sergio Unia Recupero dati da una vecchia versione MySql [Risolto] MySQL 4
spider81man [PHP] Problemi cancellazione dato su DB [RISOLTO] PHP 1
A [RISOLTO]Inserimento Immagini da pc a MySql PHP 15
A [PHP] RISOLTO Invio Mail con Tabella PHP 2
felino Risolto - [Wordpress][WooCommerce] PayPal Checkout e campi di fatturazione WordPress 2
elpirata [PHP][RISOLTO] Sommare gli importi estratti da un ciclo while PHP 3
elpirata [PHP][RISOLTO] Effettuare la somma dei tempi di lavorazione PHP 3

Discussioni simili