hej....
jeg har lavet disse 2 filer sådan man skulle kunne opdatere ens
profil den ene hedder: edit_profil.asp og ser således ud:
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>News</title>
</head>
<%
strDSN = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("site.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strDSN
%>
<%
sql ="SELECT * FROM Bruger Where Id=" & Request.Querystring("ID")
Set Rs = Conn.Execute(sql)
%>
<form name="form" method="post" form
action="opdater_profil.asp?id=<%=Rs("id")%>">
<table border="2" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" width="440" id="AutoNumber1"
bgcolor="#314C5A">
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Nick:</font></td>
<td width="358" height="22" align="right">
<p align="right"><font face="Verdana" size="1"><input
type="text" name="brugernavn_profil" size="50"
value="<%=Rs("Brugernavn")%>" class="inputbox" ></font></p>
</td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Mail:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="mail_profil"
size="50" value="<%=Rs("Mail")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Navn:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="navn_profil"
size="50" value="<%=Rs("Navn")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Efternavn:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text"
name="efternavn_profil" size="50" value="<%=Rs("Efternavn")%>"
class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Age:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="alder_profil"
size="50" value="<%=Rs("Alder")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Location:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="by_profil"
size="50" value="<%=Rs("By")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">ICQ
nr:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="icq_profil"
size="50" value="<%=Rs("icq")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Computer:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="computer_profil"
size="50" value="<%=Rs("Computer")%>"
class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Quote:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="comment_profil"
size="50" value="<%=Rs("Comment")%>"
class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Pic:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="pic_profil"
size="50" value="<%=Rs("pic")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Tidl. claner:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text" name="claner_profil"
size="50" value="<%=Rs("claner")%>" class="inputbox"></font></td>
</tr>
<tr>
<td width="290" height="22"><font face="Verdana"
size="1">Password:</font></td>
<td width="358" height="22" align="right"><font
face="Verdana" size="1"><input type="text"
name="adgangskode_profil" size="50"
value="<%=Rs("Adgangskode")%>" class="inputbox"></font></td>
</tr>
</table>
<br>
<input type="submit" value="Opdater Profil" class="inputknap">
</form>
<%
Conn.Close
Set Conn = Nothing
%>
----------------------------------------------------------------
den anden fil hedder opdater_profil.asp og ser sådan her ud:
<%
strDSN = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ="&Server.MapPath("site.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strDSN
%>
<%
sql = "UPDATE Bruger SET Brugernavn= '" &
request.form("brugernavn_profil") & "'"
sql = sql & ", Mail= '" & request.form("mail_profil") &"'"
sql = sql & ", Navn= '" & request.form("navn_profil") &"'"
sql = sql & ", Efternavn= '" & request.form("efternavn_profil")
&"'"
sql = sql & ", Alder= '" & request.form("alder_profil") &"'"
sql = sql & ", By= '" & request.form("by_profil") &"'"
sql = sql & ", Computer= '" & request.form("computer_profil")
&"'"
sql = sql & ", icq= '" & request.form("icq_profil") &"'"
sql = sql & ", Claner= '" & request.form("claner_profil") &"'"
sql = sql & ", Adgangskode= '" &
request.form("adgangskode_profil") &"'"
sql = sql & ", pic= '" & request.form("pic_profil") &"'"
sql = sql & ", Comment= '" & request.form("comment_profil") &"'"
sql = sql & "WHERE Id = " & request("ID")
Conn.Execute (sql)
Conn.Close
%>
----------------------------------------------------------------
I Databasens tabel som hedder bruger ser sådan her ud:
ID - Autonr.
Navn - Tekst
Computer - Tekst
Brugernavn - Tekst
pic - Tekst
Adgangskode - Tekst
Mail - Tekst
Comment - Tekst
Alder - Tekst
By - Tekst
Efternavn - Tekst
Rang - Tekst
claner - Tekst
icq - Tekst
Hvis i kan finde en fejl så må i meget gerne skrive en mail til
mig
på forhånd tak....
Hilsen Mathias S. Pedersen
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP ???
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials