I want to make server page that can keep a parameter just like tracking ID.
I want to pass that parameter from an asp page to another asp page when i clicked submit button.
Can someone help me to solve this, i really need to finish this soon.
So far have this code, this is January.asp page, i need to pass the userID parameter to userView.asp page :
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<% if( Request.Form("button")=="Simpan")
{var DSN = "Provider = Microsoft.JET.OLEDB.4.0;
Data Source = C:/Inetpub/wwwroot/eKehadiran/eKehadiranDataBase.mdb";
var Conn = Server.CreateObject("ADODB.Connection");
Conn.Open(DSN);
var id = Request.Form("userID");var kllsan = Request.Form("kelulusan");
var abailabel = Request.Form("available");
var sqlStmt = "INSERT INTO Januari ";
sqlStmt += "( ID,catatan,kelulusan ) ";
sqlStmt += "VALUES ";
sqlStmt += "(";
sqlStmt += "'" + id + "',";
sqlStmt += "'" + abailabel + "',";
sqlStmt += "'" + kllsan + "'";
sqlStmt += ")";
var sqlStmnt = "UPDATE userTable SET availability = '" + abailabel + "'";
sqlStmnt += "WHERE ID = "+ Request.Form("userId");
Conn.Execute(sqlStmt);Conn.Execute(sqlStmnt);Conn.Close();
Response.Redirect("userView.asp");}
%>
<% var DSN = "Provider = Microsoft.JET.OLEDB.4.0;
Data Source = C:/Inetpub/wwwroot/eKehadiran/eKehadiranDataBase.mdb";
var Conn = Server.CreateObject("ADODB.Connection"); Conn.Open(DSN);
var sqlStmt = "SELECT * FROM userTable ";
sqlStmt += "WHERE ";
sqlStmt += "ID = ";
sqlStmt += Request.QueryString("userID");
var sqlStmnt = "SELECT * FROM Januari ";
sqlStmnt += "WHERE ";
sqlStmnt += "ID = ";
sqlStmnt += Request.QueryString("userID");
var rs = Server.CreateObject("ADODB.Recordset");rs.Open ( sqlStmt, Conn );
var ss = Server.CreateObject("ADODB.Recordset");ss.Open (sqlStmnt,Conn);
%>
<html>
<head><title>Untitled Document</title></head>
<body>
<table>
<tr><td><table>
<% var out = "";
if ( ! rs.EOF )
{ out += "<tr><td>Nama Pegawai :</td>";
out += "<td>";
out += String(rs.fields.item("namaPegawai"));
out += "<input type='hidden' name='userID' value='" + String(rs.fields.item("ID")) + "'>";
out += "</td></tr>";
}
else
{out = "<tr> <td> Record Not Found! </td> </tr>";}
Response.Write ( out );
%>
</table></td></tr>
<tr><td><table>
<% var out = "";
while ( ! ss.EOF )
{
out += "<tr><td>Catatan :</b></td>";
out += "<td>";
out += String(ss.fields.item("catatan"));
out += "</td></tr>";
out += "<tr><td>Kelulusan :</b></td>";
out += "<td>";
out += String(ss.fields.item("kelulusan"));
out += "</td></tr>";
ss.move(1);}
Response.Write(out);
%>
</table></td>
<td width="245" align="left">
<select name="available" size="1" id="pilih">
<option>Mesyuarat</option><option>Kursus</option>
<option>Memantau</option><option>Tugas Luar</option></select>
<input type="text" name="kelulusan" size="35">
<input type="submit" name="button" value="Submit">
</td></tr>
</table>
</body>
</html>