473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing Variable from page to link

I have what seems to be a simple problem but I can't figure it out.

I have a page where I have a link with variables built in which I want
to pass through the URL so another page can pick the info up.

My link on the first page (schedule.html) goes to this link:
disclaimer.html ?customer=23829 7&EventID=190 80

And I have some Javascript in the page which places the link info into
the URL:

<script language="JavaS cript"><!--
function nextpage(href,s tring) {
location.href = href + '?' + string;
}
</script>

Now on the (disclaimer.htm l) page I want to receive the info in the URL
and then have a link that says "I Agree" that contains that dynamic
info. So the link would look something like this:
paymentpage.asp x?CustomerId=23 8297EventID=190 8

The problem is I have a no idea how to GET this info into the link.

Any help anyone could give me would be greatly appreciated.
Thanks,
CHouck

Jul 23 '05 #1
8 1812
mxa
hi,

you need server side code , do you have access to server ? what
languages are available?
parameter passed to a html document via get or post are avalable on
server side only.

if you don't have access to the server , you may want to consider
including or building the next html
thanks
Michael

Jul 23 '05 #2
"CHouck" <ch****@voli.co m> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have what seems to be a simple problem but I can't figure it out.

I have a page where I have a link with variables built in which I want
to pass through the URL so another page can pick the info up.

My link on the first page (schedule.html) goes to this link:
disclaimer.html ?customer=23829 7&EventID=190 80

And I have some Javascript in the page which places the link info into
the URL:

<script language="JavaS cript"><!--
function nextpage(href,s tring) {
location.href = href + '?' + string;
}
</script>

Now on the (disclaimer.htm l) page I want to receive the info in the URL
and then have a link that says "I Agree" that contains that dynamic
info. So the link would look something like this:
paymentpage.asp x?CustomerId=23 8297EventID=190 8

The problem is I have a no idea how to GET this info into the link.

Any help anyone could give me would be greatly appreciated.
Thanks,
CHouck


Will this work for you? Watch for word.wrap.

<html>
<head>
<title>disclaim er.html</title>
<script type="text/javascript">
var qstr = location.search ;
qstr = qstr.replace(/\?/g,"&");
var pair = qstr.split("&") ;
var valu = new Array("","");
for (var i=1; i<pair.length; i++) {
var parm = pair[i].split("=");
if (parm[0] = "customer") valu[0] = parm[1];
if (parm[0] = "EventID") valu[1] = parm[1];
}
var page = "paymentpage.as px"
page += "?CustomerI d=" + valu[0];
page += "&EventID=" + valu[1];
function nextpage() {
location.href = page;
}
</script>
</head>
<body>
<a href="javascrip t:nextpage()">I agree</a>
</body>
</html>
Also, if your calling link looks like

<a
href="javascrip t:nextpage('htt p://www/','disclaimer.h tml?customer=23 8297&Eve
ntID=19080')">l ink</a>

why not remove the function by changing it to

<a href="http://www/disclaimer.html ?customer=23829 7&EventID=19080 ">link</a>
Jul 23 '05 #3
<mx*@yahoo.co m> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
hi,

you need server side code , do you have access to server ? what
languages are available?
parameter passed to a html document via get or post are avalable on
server side only.
Not true. You can access the querystring via location.search on the
client-side.
if you don't have access to the server , you may want to consider
including or building the next html
thanks
Michael

Jul 23 '05 #4
CHouck wrote:
I have what seems to be a simple problem but I can't figure it out.

I have a page where I have a link with variables built in which I want
to pass through the URL so another page can pick the info up.

My link on the first page (schedule.html) goes to this link:
disclaimer.html ?customer=23829 7&EventID=190 80

And I have some Javascript in the page which places the link info into
the URL:

<script language="JavaS cript"><!--
function nextpage(href,s tring) {
location.href = href + '?' + string;
}
</script>

Now on the (disclaimer.htm l) page I want to receive the info in the URL
and then have a link that says "I Agree" that contains that dynamic
info. So the link would look something like this:
paymentpage.asp x?CustomerId=23 8297EventID=190 8

The problem is I have a no idea how to GET this info into the link.

Any help anyone could give me would be greatly appreciated.
Thanks,
CHouck


Hi,
i hope i did unterstand right what you want, basically extracting GET
information from the url.
the following code snippet extracts everything after the first '=' in
the url. with a bit of string manipulation you can modify it for your needs.
And with a little DOM you can then modify the href attribute of the link
after the page is loaded.

if (window.locatio n.search != "") {
var text = window.location .search;
var exempt =
text.substring( location.search .indexOf("=")+1 ,location.searc h.length);
}

Jul 23 '05 #5
Thanks everyone for your help. I used McKirahan's (Thanks McKirahan)
code and everything seems to be working Ok the only thing I 'm having
problems with now is that when I click on the link that uses
nextpage(), the URL is passing the EventID to both string parameters.
So both CustomerID and EventID have the EventId in them. Any ideas...
Thanks again,
CHouck

Jul 23 '05 #6
"CHouck" <ch****@voli.co m> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. .
Thanks everyone for your help. I used McKirahan's (Thanks McKirahan)
code and everything seems to be working Ok the only thing I 'm having
problems with now is that when I click on the link that uses
nextpage(), the URL is passing the EventID to both string parameters.
So both CustomerID and EventID have the EventId in them. Any ideas...
Thanks again,
CHouck


Show us your code, please.
Jul 23 '05 #7
"CHouck" <ch****@voli.co m> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I have what seems to be a simple problem but I can't figure it out.

I have a page where I have a link with variables built in which I want
to pass through the URL so another page can pick the info up.

My link on the first page (schedule.html) goes to this link:
disclaimer.html ?customer=23829 7&EventID=190 80

And I have some Javascript in the page which places the link info into
the URL:

<script language="JavaS cript"><!--
function nextpage(href,s tring) {
location.href = href + '?' + string;
}
</script>

Now on the (disclaimer.htm l) page I want to receive the info in the URL
and then have a link that says "I Agree" that contains that dynamic
info. So the link would look something like this:
paymentpage.asp x?CustomerId=23 8297EventID=190 8

The problem is I have a no idea how to GET this info into the link.

Any help anyone could give me would be greatly appreciated.
Thanks,
CHouck


Do the QueryString "names" ("customer" versus "CustomerId ") have to be
different between the two pages?

disclaimer.html ?customer=23829 7&EventID=190 80

paymentpage.asp x?CustomerId=23 8297EventID=190 8
If they could be made the same then you could just pass on the entire
QueryString:

<html>
<head>
<title>disclaim er.html</title>
<script type="text/javascript">
function nextpage() {
location.href = "paymentpage.as px" + location.search ;
}
</script>
</head>
<body>
<a href="javascrip t:nextpage()">I agree</a>
</body>
</html>

<a href="disclaime r.html?Customer Id=238297&Event ID=19080">Discl aimer</a>
Jul 23 '05 #8
You just answered my question...ever ything works great now.

Thank you !!!

CHouck

BTW, the customer versus customerID thing was my screwup it was just
supposed to be customerID for each page. My brains not running on all
cylinders these days.

Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3535
by: Hans | last post by:
Hi There, I have a page that has links with some variables and I need to open the results set in a frameset. I have tried doing this in various different ways, but still cannot get the variable passed to the relevant frames within the frameset. What is the best way of getting this done. Thanks Hans
6
2253
by: Rob Meade | last post by:
Hi all, At work we have 2 servers in a cluster for our web apps. One problem we have experienced (along with many others!) - is that if a user is logged into one of the applications on server a for example and it goes offline or fails their session is lost also - even though the application becomes available on server b. I have heard that it is possible to either exchange the sessions between
2
3869
by: Jeff | last post by:
I have a question. Is it possible to send a variable through a hyperlink, to a frames page, and have all 3 pages in the frame pick up the variable using the request.querystring ? In other words, I click on a link that has ?id=2 lets say.. it goes to a page called umm say index.asp the index page has a top, main, and a left. how do i get each one of those to receive the variable, when i can only send it to one page? or is it possible...
5
6698
by: Jack | last post by:
Hi, I need to pass multple variables in a link in order to go to a asp page with the two varables. The following are the values of the variables using response.write: <%'Response.Write Mypage & "<br>"%> Exp <%'Response.Write GrantID & "<br>"%>
6
7094
by: veganeater | last post by:
Hi Everyone, I was wondering if there was a way to pass a variable to a popup window. The purpose is make it so when a user clicks on a specific region/link of the glossary page, a popup opens with the related description. This is done and is obviously not a concern. However, now I would like to make it so the corresponding row becomes highlighted (changes background colour via DOM). I imagine it can be done, but I'm at a loss for...
3
1986
by: James Robertson | last post by:
I am new to the ASP and VB thing so be kind. Question I have is that I have created an ASPX web site to use as an E-Mail page. But I want to use this for a lot of users. Can I create the link on the WEB site to mail to passing a variable from the WEB site to the ASPX web site to E-Mail to? Hope I explained this correctly. This is a response from another group. There was no way for you to know it, but this is a classic asp newsgroup....
4
3468
by: sofeng | last post by:
The following link shows a chart I created about passing structures among functions. Would you review it and tell me if it requires any corrections? http://bp2.blogger.com/_lZhqNsiakm4/Reh26hy-JHI/AAAAAAAAAAk/wvyV3Yx8gSs/s1600-h/gif_1.gif Thank you. sofeng
3
2808
by: Wolfman | last post by:
Hi guys I thank you for being the most helpful and responsive tech group around, and I have a new one for you. Have you ever embedded Hulu on a page before? I use it quite extensively in popup "player" windows, and as each popup page requires slightly varied object/embed parameters specifying to which Hulu file to link, I've been creating a different HTML page for each popup. Now however, I face creating a multitude of individual popup...
13
3333
by: wizardry | last post by:
hello - trying to pass variable through url from the database query. i query and store the id in $id and put that in: <a href="list.php?Id=$Id"><img src="<?php echo $row_list; ?>
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9243
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.