1,105,225 Community Members

Parsing information between pages in ASP

Member Avatar
jelly46
Junior Poster in Training
68 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am developing a page so i can parse information from one page to another.

one page has three options and when the users clicks on the options they was want they then click on the send button.

That choice will be seen on the next page which is past of a form.

Can someone point me in the right direction for this to work in asp.

Thanks

Member Avatar
JorgeM
IT Addict
6,381 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

So just to clarify asp or asp.net? You can use request.form

Member Avatar
jelly46
Junior Poster in Training
68 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

asp or asp.net, i dont know but i am looking for a form handler, if that help.

Thanks mate

Member Avatar
JorgeM
IT Addict
6,381 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

You can get the value of one form element simply by using the request.form collection. For example.. If the element is name, then...

Vb.net example

Dim name as string
name=request.form("name")

Take a look at this guide for more details. Examples are close enough for asp or asp.net.

Request.Form

Member Avatar
jelly46
Junior Poster in Training
68 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for your help on this so far, here is my code below. What i want to happen is when the user chooses the amount they want they click on submit. Now that amount will be passed on to the next page.

The problem is i dont understand the code in the handler, but i will look on the pafge you sent.

Thanks

<form id='sampleform' method='post' action='handler.asp' >
   <p>
   Name: <input type='text' name='Name' />
   </p>
   <p>
   Email: <input type='text' name='Email' />
   </p>
<input type="radio" name="subject" value="ten" /> &pound;10
<input type="radio" name="subject" value="five" /> &pound;5
<input type="radio" name="subject" value="three" /> &pound;3
&pound;<input type='text' name='donate-amount' />
   <p>
   <input type='submit' name='Submit' value='Submit' />
   </p>
</form>
Member Avatar
JorgeM
IT Addict
6,381 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

Ok so this is classic asp code (handler.asp). So in the handler.asp page you can access those form elements by either creating a loop and accessing all of the items, or just accesses them individually...

Request.Form("name")
Request.Form("email")
Request.Form("subject")
Request.Form("donate-amount")
Member Avatar
jelly46
Junior Poster in Training
68 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks for this Jorge, this is a big help.

Here is the final form code:

<form id='sampleform' method='post' action='handler.asp' >
<input type="radio" name="ten" value="ten" /> &pound;10
<input type="radio" name="five" value="five" /> &pound;5
<input type="radio" name="three" value="three" /> &pound;3
&pound;<input type='text' name='donate-amount' />
   <p>
   <input type='submit' name='Submit' value='Submit' />
   </p>
</form>

Is this handler code correct, do i place it just in the asp page?

Request.Form("ten")
Request.Form("five")
Request.Form("three")
Request.Form("donate-amount")

Finally i want it to go to a url, where do i place the url in the code.

Thanks for all your so far

Member Avatar
JorgeM
IT Addict
6,381 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

do i place it just in the asp page?

No, the example I provided will most likely need to be assigned to a variable I assume. The request.form("parameter") is holding the information. You have to do something with it. For example, you can declare a variable, assign the value of that form item to the variable, then do something with it such as write it to the page...

<%
Dim email
email = Request.Form("email")
Response.Write (email)
%>

This is just an example... the correct answer depends on what you want to do with the information you passed.

Finally i want it to go to a url, where do i place the url in the code.

I dont know what you mean by this...Do you mean a hyperlink? Do you want to redirect to another page? For example <% Response.Redirect("http://www.new-domain.com") %>

Member Avatar
jelly46
Junior Poster in Training
68 posts since Sep 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thanks Jorge, but i don't understand do you know of any example?
If not now worries.
Thanks

Member Avatar
JorgeM
IT Addict
6,381 posts since Dec 2011
Reputation Points: 567 [?]
Q&As Helped to Solve: 953 [?]
Skill Endorsements: 172 [?]
Moderator
Featured
Sponsor
 
0
 

Ok, i guess there is something missing here. You are posting the form to a file called handler.asp. What code do you have in that file? If you havent created that file yet and you just copied this form from somewhere, I think that is where the confusion is.

You need to write asp code in the handler.asp file. In the example I just provided, if you open a new text document and save it as "handler.asp" with this code, it should display the contents of the parameter "email" on the screen.

<%
Dim email
email = Request.Form("email")
Response.Write (email)
%>

If you are not familiar with asp, you may need to read up on it a bit more to get more familiar, otherwise its going to be rough for you to move forward and maintain the code.

Member Avatar
G_Waddell
Practically a Posting Shark
821 posts since Nov 2009
Reputation Points: 131 [?]
Q&As Helped to Solve: 137 [?]
Skill Endorsements: 13 [?]
 
0
 

Hi,

Your form Action is set to handler.asp this means the form submits to the page handler.asp for processing.

In the Handler page you do something like this:

<%
    'as your using classic ASP your radio button can all be called the same thing:
    dim myURL as string =""
    Select Case Request.Form("Subject")
        case "ten"
            myURL = "/tenpage.asp" 'where ever you go if this value is selected
        case "five"
            myURL ="/fivepage.asp"  
        case else 'three
            myURL ="/threepage.asp"
    End Select
    Reponse.redirect myURL

%>  
Member Avatar
AlmalynC88
Newbie Poster
3 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

If you ARE NOT passing sensitive data, this may help.

Original page:
protected void Button1_Click(object sender, EventArgs e)

      string MyOccupation = "Software Developer";

      string url;
      url = "page2.aspx?occupation=" + MyOccupation;

      Response.Redirect(url);

Next Page:
string RetrievedValue;protected void Page_Load(object sender, EventArgs e)

      this.TextBox1.Text = Request.QueryString["occupation"];
      RetrievedValue = this.TextBox1.Text;
nicz17
Newbie Poster
2 posts since Apr 2013
Reputation Points: -1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
-2
 

i dont think so..

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article