Basically I got a page which lists all the records in a database:
When the user clicks the button on left under staff ID they are then shown the following:
The above was coded using ASP and SQL, the above shows the update one and when clicked any changes are saved, I have exactly the same code for the delete, its brought up in similar window but there is a "delete record" button at bottom instead, basically I want delete record and update record both on same page, I have the code for both how do I put them together on one page?
Think its to do with VB or ASP, where u have "if" or "else" statements!
Code for update is:
<form method="post" action="demo_update.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><%=x.name%></td>
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Update record">
</form>
<%
else
sql="UPDATE staff SET "
sql=sql & "sname='" & Request.Form("sname") & "',"
sql=sql & "fname='" & Request.Form("fname") & "',"
sql=sql & "dob='" & Request.Form("dob") & "',"
sql=sql & "dept='" & Request.Form("dept") & "'"
sql=sql & " WHERE staffid=" & cid & ""
on error resume next
conn.Execute sql
if err<>0 then
response.write("No update permissions!")
else
response.write("Record " & cid & " was updated!")
end if
end if
conn.close
%>
Code for delete is :
<form method="post" action="demo_delete.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><%=x.name%></td>
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Delete record">
</form>
<%
else
sql="DELETE FROM staff"
sql=sql & " WHERE staffid=" & cid & ""
'on error resume next
conn.Execute sql
'if err<>0 then
'response.write("No update permissions!")
response.write("Record " & cid & " was deleted!")
end if
conn.close
%>
Basically how do I merge them together so they are both on same page?
Cheers!!!!
When the user clicks the button on left under staff ID they are then shown the following:
The above was coded using ASP and SQL, the above shows the update one and when clicked any changes are saved, I have exactly the same code for the delete, its brought up in similar window but there is a "delete record" button at bottom instead, basically I want delete record and update record both on same page, I have the code for both how do I put them together on one page?
Think its to do with VB or ASP, where u have "if" or "else" statements!
Code for update is:
<form method="post" action="demo_update.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><%=x.name%></td>
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Update record">
</form>
<%
else
sql="UPDATE staff SET "
sql=sql & "sname='" & Request.Form("sname") & "',"
sql=sql & "fname='" & Request.Form("fname") & "',"
sql=sql & "dob='" & Request.Form("dob") & "',"
sql=sql & "dept='" & Request.Form("dept") & "'"
sql=sql & " WHERE staffid=" & cid & ""
on error resume next
conn.Execute sql
if err<>0 then
response.write("No update permissions!")
else
response.write("Record " & cid & " was updated!")
end if
end if
conn.close
%>
Code for delete is :
<form method="post" action="demo_delete.asp">
<table>
<%for each x in rs.Fields%>
<tr>
<td><%=x.name%></td>
<td><input name="<%=x.name%>" value="<%=x.value%>"></td>
<%next%>
</tr>
</table>
<br /><br />
<input type="submit" value="Delete record">
</form>
<%
else
sql="DELETE FROM staff"
sql=sql & " WHERE staffid=" & cid & ""
'on error resume next
conn.Execute sql
'if err<>0 then
'response.write("No update permissions!")
response.write("Record " & cid & " was deleted!")
end if
conn.close
%>
Basically how do I merge them together so they are both on same page?
Cheers!!!!