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

Recommended Answers

All 12 Replies

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

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

Thanks mate

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

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>

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")

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

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") %>

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

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.

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

%>  

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;

i dont think so..

commented: don't think what?? -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.