<%@LANGUAGE = JScript%>
<%
var id = parseInt(Request.QueryString("id"));
if (isNaN(id))
{
Response.Redirect("index.asp");
}
var Rs = Cn.Execute("SELECT * FROM news WHERE id = " + id);
var azione = new String(Request.QueryString("azione"));
%>
<table align="center" width="400" cellpadding="1" cellspacing="0" border="1">
<form method="POST" action="modifica.asp?id=<%=id%>&azione=UPD">
<tr>
<td colspan="2" height="21">Modifica i dati </td>
</tr>
<tr>
<td width="150">Oggetto</td>
<td width="250">
<input type="text" name="titolo" value="<%=Rs("titolo")%>" size="116"></td>
</tr>
<tr>
<td height="80">Messaggio</td>
<td height="80">
<textarea name="descrizione" cols="100" rows="11"><%=Rs("descrizione")%></textarea></td>
</tr>
<tr>
<td colspan="2" align="right"><input type="submit" value="Modifica"></td>
</tr>
<tr>
<td>Leggi
</td><td align="right"></td></tr>
</form>
</table>
<%
if (azione== "UPD")
{
var nome = new String(Request.Form("titolo"));
var cognome = new String(Request.Form("descrizione"));
if (titolo == "" || descrizione == "")
{
Response.Redirect("modifica.asp?id=" + id);
}
else
{
var r_titolo = titolo.replace(/'/g,"''");
var r_descrizione = descrizione.replace(/'/g,"''");
Cn.Execute("UPDATE news SET titolo = '" + r_titolo + "', descrizione = '" + r_descrizione + "' WHERE id = " + id);
Cn.Close();
Response.Write("<p align=\"center\">Modifica effettuata!</p>");
}
}
%>
mi da questo errore:
Microsoft JScript runtime error '800a1391'
'titolo' is undefined
modifica.asp, line 48
la linea 48 è:
var r_titolo = titolo.replace(/'/g,"''");
:master: