ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old February 24th, 2003, 01:11 PM
raven19j raven19j is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 9 raven19j User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question how do i reload the page to show new info with multiple submit buttons

hi all,
i am new to asp and web designing, and was wondering how to reload a page so that a different set of images appear, depending on which submit button is pressed.


<center>
<form>
<br><p>
Choose the year to view: <br><br>

<input type="submit" value="1800" name=year1800>
<input type="submit" value="1850" name=year1850>
<input type="submit" value="1900" name=year1900>
<input type="submit" value="1950" name=year1950>
<input type="submit" value="2000" name=year2000></center>
</form>

i'm not sure how to use the various values. would i need to use an IF statement, and if so, how?

any help would be much appreciated.

j
Comments on this post
Gran Roguismo agrees!

Reply With Quote
  #2  
Old February 24th, 2003, 04:20 PM
raven19j raven19j is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 9 raven19j User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up all sorted

don't worry folks. I managed to sort it out. found a site which really helped due to the relevant example:
[URL=http://www.4guysfromrolla.com/webtech/040499-1.shtml[/URL]

Reply With Quote
  #3  
Old February 24th, 2003, 04:22 PM
jholmes jholmes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 15 jholmes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
instead of making the names for all the submit buttons different, make them the same. then when the user hits submit, the value of that submit button will be sent to the asp page. in the asp page, you can then use Request.Form to get the value of what button was pressed using one name.

or, in the form, use this:

<center>
<form>
<br><p>
Choose the year to view: <br><br>

<input type="submit" value="1800" name="year">
<input type="submit" value="1850" name="year">
<input type="submit" value="1900" name="year">
<input type="submit" value="1950" name="year">
<input type="submit" value="2000" name="year">
</center>
</form>

(examples i give are in jscript!)
then in the asp page, get the value of year:

year = Request.Form("year");

then use an if statement (or case...) to write fill in the variables which the page will show:

if (year == "1800") {
pic1 = "1800_1.jpg";
pic2 = "1800_2.jpg";
etc.
}
else if (year == "1850") {
pic1 = "1850_1.jpg";
pic2 = "1850_2.jpg";
etc.
}

then show the pictures:

in html:
<img src="<%=pic1%>">
<img src="<%=pic2%>">

or in asp:

Response.Write("<img src='" + pic1 + "'>");
Response.Write("<img src='" + pic2 + "'>");

etc.

Reply With Quote
  #4  
Old February 24th, 2003, 04:40 PM
raven19j raven19j is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 9 raven19j User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks for the help

thanks for the help jholmes. i just figured it out though. my code looks like this:

<%

Dim mapyear
mapyear = CStr(Request("year"))
Response.Write(mapyear)
%>

</pre>


<%if mapyear = "1800" then %>

<img alt= "works" src="images/pics/pigs.bmp">

<%elseif mapyear = "1850" then %>

<img alt= "works" src="images/pics/horses.bmp">

<%elseif mapyear = "1900" then %>

<img alt= "works" src="images/pics/cows.bmp">


<%end if%>
<pre>



</pre>

<form METHOD="Get">
<br><p>
Choose the year to view: <br><br>

<input type="submit" value="1800" name=year>
<input type="submit" value="1850" name=year>
<input type="submit" value="1900" name=year>
<input type="submit" value="1950" name=year>
<input type="submit" value="2000" name=year>
</form>


it works, but i don't know if its the best method. I'll take your points into careful consideration
cheers.

oh, just one more question.
i know there are several advantages of using post, but are there any benefits of using get as opposed to post?

Reply With Quote
  #5  
Old February 24th, 2003, 05:57 PM
jholmes jholmes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 15 jholmes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
from my experience, GET works good for short variables, which you can easily use to assemble urls. so if there are a few things you want to set on the page when it loads, and you (not the user) are controlling the querystring, GET is excellent. however, as i found out the hard way while writing the application i'm currently working on, GET becomes extra-sketchy with multi-line inputs and apostrophes/quotes. so using POST is better for maintaining data integrity, but it can be more work to put information into a form to be submitted (whereas you can just tack a querystring onto any url without using the official form elements)...

Reply With Quote
  #6  
Old February 25th, 2003, 06:22 AM
faithiology faithiology is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: egypt
Posts: 16 faithiology User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question i had misunderstanding now

So jholmes

i had misunderstanding now
Whats the real different between GET and POST
and i mean all differents



thank u for help

Reply With Quote
  #7  
Old February 25th, 2003, 11:36 AM
jholmes jholmes is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 15 jholmes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
well, the main difference between get and post is how data is sent to the next page. subsequently, retrieval of that data can require different scripting.

i can't possibly explain it as you should probably learn it, so here's a page which details the differences:

http://www.cs.tut.fi/~jkorpela/forms/methods.html

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > how do i reload the page to show new info with multiple submit buttons


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway