473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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=238297&EventID=19080

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

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

Now on the (disclaimer.html) 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.aspx?CustomerId=238297EventID=1908

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 1788
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.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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=238297&EventID=19080

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

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

Now on the (disclaimer.html) 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.aspx?CustomerId=238297EventID=1908

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>disclaimer.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.aspx"
page += "?CustomerId=" + valu[0];
page += "&EventID=" + valu[1];
function nextpage() {
location.href = page;
}
</script>
</head>
<body>
<a href="javascript:nextpage()">I agree</a>
</body>
</html>
Also, if your calling link looks like

<a
href="javascript:nextpage('http://www/','disclaimer.html?customer=238297&Eve
ntID=19080')">link</a>

why not remove the function by changing it to

<a href="http://www/disclaimer.html?customer=238297&EventID=19080">lin k</a>
Jul 23 '05 #3
<mx*@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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=238297&EventID=19080

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

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

Now on the (disclaimer.html) 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.aspx?CustomerId=238297EventID=1908

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.location.search != "") {
var text = window.location.search;
var exempt =
text.substring(location.search.indexOf("=")+1,loca tion.search.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.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.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.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.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=238297&EventID=19080

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

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

Now on the (disclaimer.html) 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.aspx?CustomerId=238297EventID=1908

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=238297&EventID=19080

paymentpage.aspx?CustomerId=238297EventID=1908
If they could be made the same then you could just pass on the entire
QueryString:

<html>
<head>
<title>disclaimer.html</title>
<script type="text/javascript">
function nextpage() {
location.href = "paymentpage.aspx" + location.search;
}
</script>
</head>
<body>
<a href="javascript:nextpage()">I agree</a>
</body>
</html>

<a href="disclaimer.html?CustomerId=238297&EventID=19 080">Disclaimer</a>
Jul 23 '05 #8
You just answered my question...everything 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
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...
6
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...
2
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...
5
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...
6
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...
3
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...
4
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? ...
3
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...
13
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.