我試圖提交表單的處理程序頁面,但現在沒有什麼工作,它甚至不打...處理器提交表單到處理器不工作
這裏是我的代碼:
<form action="Unsubscription.ashx?actionmethod=subscribe" method="get" >
<div class="h1">
<input type="text" class="input" value="enter your e-mail" name="ekey" />
<input type="submit" value="Submit" />
</div>
</form>
處理代碼:
public void ProcessRequest(HttpContext context)
{
try
{
string email = context.Request.Params["ekey"];
switch (context.Request.Params["actionmethod"])
{
case "subscribe":
NewsLetter.Subscribe(email);
break;
case "unsubscribe":
NewsLetter.Unsubscribe(email);
context.Response.ContentType = "text/html";
context.Response.Write("your subscription has been successfully canceled. thanks.<br/><a href='http://www.kayatax.com'><b>home page</b></a>");
break;
}
}
catch {
context.Response.ContentType = "text/html";
context.Response.Write("This e-mail doesn't exist in our database. Thanks.<br/><a href='http://www.kayatax.com'><b>Home Page</b></a>");
}
}
好的,我改變了它,但現在我無法看到渲染後的表單元素。我不知道爲什麼,也不是很有趣。 Firebug不顯示提交按鈕周圍的表單元素。 – Tarik 2009-10-13 01:16:36
關閉表格標籤,如「」中所述。請注意斜槓。你剛剛把另一個開放「
(facepalm)...... – CRice 2009-10-13 01:27:43