
18/12/2002, 08:15
|
 | | | Fecha de Ingreso: septiembre-2001 Ubicación: Granada, España
Mensajes: 263
Antigüedad: 23 años, 8 meses Puntos: 0 | |
Aqui está completo. No sé salir del problema!!
El archivo se llama agrega_noticia.asp y el formulario es: <SCRIPT LANGUAGE=VBSCRIPT>
Sub Enviar()
if Trim(document.all.copete.value) = "" or Trim(document.all.titulo.value) ="" or Trim(document.all.noticia.value ="") then
Msgbox "Debe completar todos los datos."
else
document.all.form1.action="agrega_noticia.asp"
document.all.form1.submit
end if
End Sub
</SCRIPT>
<img border="1" src="../archivos/www.gif">
</p>
<p><font face="arial"><b>Rellena el siguiente formulario para insertar Noticias:</b></font>
<form method="POST" action="agrega_noticia.asp">
<p>Titulo:<br>
<input type="text" name="titulo" size="40"></p>
<p>Copete:<br>
<input type="text" name="copete" size="40"></p>
<p>Noticia:<br>
<textarea rows="4" name="noticia" cols="30"></textarea></p>
<p><input type="submit" onclick="Enviar()" value="Crear noticia" name="enviar"></p>
</form> agrega_noticia.asp <%
Response.Buffer=true
dim cnn,rst
set cnn = Server.CreateObject("ADODB.Connection")
set rst = Server.CreateObject("ADODB.RecordSet")
cnn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("noticias.mdb"))
sqltext = "SELECT * FROM Noticias"
rst.Open sqltext,cnn,3,3
dim titulo, copete, noticia
titulo = Request.Form("titulo")
copete = Request.Form("copete")
noticia = Request.Form("noticia")
if copete = "" or titulo ="" or noticia ="" then
error = "Debe completar todos los datos."
Response.Write error
Response.End
end if
rst.AddNew
rst("titulo") = titulo
rst("copete") = copete
rst("noticia") = noticia
rst.update
Response.Write "La noticia se ha ingresado con exito"
%>
aiiiiiiiiiiiiiii!!!
__________________ "El Universo simpre quiere que ganemos" |