Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing an array thru the URL with the GET method

Status
Not open for further replies.

wrbodine

Programmer
Aug 24, 2000
302
US
Hi,

I have an .asp page with a long list of ids, that have <a href > tags where I'm passing variables to the next .asp page using the GET method (thru the url). On the next page I get the id and populate the form with data using that id. Now I want to pass an array with all the ids, so I can scroll from one to the next (on that second page).

Is there any way to pass an array with a list of IDs thru the QueryString (URL)?

Thanks,
Ray
 
If you can't get that method to work you can pass it via a Session object...
 
the most efficient way to do this always I would say is jsut to create a form with a hidden field and give the array elements (values) to it passing it along with tot he next page. In that page a simple split with recreate you array for you to use again.


_________________________________________________________
[sub]$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
Thanks jackfl and onpnt...

a Session variable would work, but my supervisor wants us to steer clear of those.

onpnt, I'm thinking of trying your suggestion, posting the variables using a form object. The trick there is I need to call a function where I could submit the form when the user clicks on the id field. I'm wondering how to make these numbers &quot;clickable&quot;, i.e. how to submit the form thru a Javascript function when the user clicks on one of them. Any ideas????

Thanks,
Ray
 
you have quite a few options.
use a <span> with a onClick would be what I think I would pursue. something like
<html>
<head>
<script language=&quot;javascript&quot;>
function submitForm() {
frm.submit();
}
</script>
</head>
<body>
<form name=&quot;frm&quot;>
<input type=&quot;hidden&quot; name=&quot;vals&quot; value=&quot;123456&quot;>
<span onClick=&quot;return submitForm()&quot;>123456</span>
</form>
</body>
</html>

which is pretty straight forward and browser compatible. The nice thing about the onClick event in javascript is it is valid for just about every object you have.

_________________________________________________________
[sub]$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;[/sub]
onpnt2.gif
[sup] [/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top