Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating 1 Forms from Another?

Status
Not open for further replies.

jward

MIS
Dec 21, 2000
57
US
I have a page with a form (name=frmedit) that allows users to add articles to be displayed on that Page. The articles are stored in a database.For every article I generate a form (name=frmArticleID#) with a submit button (name=frmArticleID# value=edit). What I want is when they click the edit button the page refreshes and loads the information into the edit form from the database. Is there a easy way of doing this?
 
Here is a quick example of how to populate information
from one form to the next. This is one way to do it, if
you don't like it you can always try using session variables.


originalform.asp
<%
' place this at the top of the originalform.asp
if Request.Form(&quot;select&quot;)<>&quot;&quot; then
Response.Redirect(Request.Form(&quot;select&quot;))
end if
%>

<form method=&quot;post&quot; action=&quot;editpageform.asp&quot;>
<input type=&quot;text&quot; name=&quot;location_name&quot;>
<input type=&quot;text&quot; name=&quot;location_address&quot;>
<input type=&quot;text&quot; name=&quot;location_city&quot;>
<input type=&quot;text&quot; name=&quot;location_zipcode&quot;>
<input type=&quot;text&quot; name=&quot;location_phone&quot;>
<input type=&quot;text&quot; name=&quot;location_directions&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Add New Location&quot;>
<input type=&quot;reset&quot; name=&quot;Reset&quot; value=&quot;Clear Form&quot;>
</form>


editpageform.asp

'*** Get data from form
location_name = Request.Form(&quot;location_name&quot;)
location_address = Request.Form(&quot;location_address&quot;)
location_city = Request.Form(&quot;location_city&quot;)
location_zipcode = Request.Form(&quot;location_zipcode&quot;)
location_phone = Request.Form(&quot;location_phone&quot;)
location_directions = Request.Form(&quot;location_directions&quot;)


<form method=&quot;post&quot; action=&quot;editpageform.asp&quot;>
<input type=&quot;text&quot; name=&quot;location_name&quot; value=&quot;<%=location_name%>&quot;>
<input type=&quot;text&quot; name=&quot;location_address&quot; value=&quot;<%=location_address%>&quot;>
<input type=&quot;text&quot; name=&quot;location_city&quot; value=&quot;<%=location_city%>&quot;>
<input type=&quot;text&quot; name=&quot;location_zipcode&quot; value=&quot;<%=location_zipcode%>&quot;>
<input type=&quot;text&quot; name=&quot;location_phone&quot; value=&quot;<%=location_phone%>&quot;>
<input type=&quot;text&quot; name=&quot;location_directions&quot; value=&quot;<%=location_directions%>&quot;>
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Add New Location&quot;>
<input type=&quot;reset&quot; name=&quot;Reset&quot; value=&quot;Clear Form&quot;>
</form>

Hope this helps,
Scott
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top