how to pass values from one page to other?

2019-03-04 17:54发布

问题:

i have page as view category and on that page there is category name,image name and url get display an that view category page there is also edit button now i want to edit category name,image name and url for that i need to pass that three values to another page as editpage, category name and url read in following code: firstly i want to pass image name to editpage for i tried like:

<form Name="frmEdit" method="post" action="<%=Request.ServerVariables("PATH_INFO")%>">
    <!--for edit-->
    <td align="left" valign="top" class="text">
        <input type="hidden" name="fileId1" value=.<%=mid(FileName.Path,instrrev(FileName.Path,"\")+1)%>">
        <div class="btn"><input  type="submit" name="AskEdit" value="Edit" style="margin-bottom:-10px"></div>
    </td>
</form>

and to pass value:

if Request.Form("AskEdit") = "Edit" then
    response.Redirect("edit_category.asp?fid=" & fileId1)
end if

but i getting error for this response.Redirect("edit_category.asp?fid=" & FieldID line

so please help me,

回答1:

Try this:

if Request.Form("AskEdit") = "Edit" then
    response.Redirect("edit_category.asp?fid=" & request.form("fileId1"))
end if


回答2:

If the code that you have posted is a direct copy of your code, you have a . where there should be a " which may be preventing the value from posting correctly.

<input type="hidden" name="fileId1" value=.<%=mid(FileName.Path,instrrev(FileName.Path,"\")+1)%>"> 

should be

<input type="hidden" name="fileId1" value="<%=mid(FileName.Path,instrrev(FileName.Path,"\")+1)%>"> 


回答3:

The answer is simpler. You have to put call when calling a method using parenthesis. Or not use parenthesis.

call response.Redirect("edit_category.asp?fid=" & request.form("fileId1"))

or

response.Redirect "edit_category.asp?fid=" & request.form("fileId1")


标签: asp-classic