/    Sign up×
Community /Pin to ProfileBookmark

Passing params from one page to another

I am working on updating my gallery pages on my webiste. i currently have 88 pages to display my photos. I want to cut it down to just 11 pages (300 pics per gallery, approx 27 pics per page). I have the code that displays the pics in a .js file. I know it can be done but not sure how, On the main gallery page i want to set a variable to the corrosponding gallery, (ie: if gallery 1 is chosen then the variable is set to 1, if gallery 8 is chosen then the variable is set to 8). Then I need to pass this variable to the first page of the photogallery htm file. How is this done? Thanks for your help.

JB….

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Feb 22.2003 — Try this link..

It should give you a clear idea how you can pass variables from one page to another..

http://68.145.35.86/skills/javascripts/DemoForwardFormDataViaURL.html

Cheers

Khalid
Copy linkTweet thisAlerts:
@jbetts1967authorFeb 22.2003 — if at all possible using forms is not the way i want to go.

here is the webpage that i want to upgrade to the new way to access the photo gallery:

http://damanbillgoldberg.0catch.com/goldbergphotogallery01.htm

when you click on the 01 button .. 04 button .. 08 button .. etc... i want it to pass a param to the page thats being called to display that gallery of pictures. can the onclick command be used and if so how would it be used to pass params from page to page? what about cookies would that work? if so how?

jb....
Copy linkTweet thisAlerts:
@urxlncFeb 22.2003 — I don't want to sound stupid, but the link Khalid gave, I am a bit confused, I don't know how and where this code is written,

<html><head><title>A URL parser sent by a form to this page. Khalid Ali</title></head><body><div align='center'>Following are the values submitted by user to this page.<br><table style='font-family:sans-serif;font-size:10pt;border:solid 1pt Gray;width:400pt;'><tr><td width="35%"><b>Form Field Name<b/></td><td width="65%"><b>Value entered by user</b></td></tr><tr><td>name</td><td></td></tr><tr><td>address</td><td></td></tr><tr><td>city</td><td></td></tr><tr><td>country</td><td></td></tr></table></div></body></html>[/QUOTE]

coz I don't see any Javascript file which is making the the above...

I guess I am more confused than anything, but all I wanna know is, and I think this would also help [B]jbetts1967[/B]

When I pass the parameter to the same html file, (the form submits to its own html file) a javascript file should fetch the parameters. I am using a downdown menu.

The thing that is confusing me is, when there is no parameter then what the javascript will fetch and how.
Copy linkTweet thisAlerts:
@khalidali63Feb 22.2003 — [i]Originally posted by jbetts1967 [/i]

[B]if at all possible using forms is not the way i want to go......... [/B][/QUOTE]


The link I gave you uses the URL to pass the one pges values to another.

I thought you might get the idea,I guess not.

to pass a variable to another page or to the same page for that matter you use this syntax.

var someVar = "this is some value"

window.location.href = window.location.href+"?"+someVar ;

This will pass this variable value to itself.You will see this in location bar.


window.location.href = "nextPage.html?"+someVar ;

This will pass it to the next page.

cheers

Khalid
Copy linkTweet thisAlerts:
@urxlncFeb 22.2003 — However, you'll find the JavaScript in the second and third pages that is performing the actual work [/QUOTE]

I was trying to see if there is a way I can call the same HTML file on submit, I mean to say, there is no second or third file, (or there could be a second file, but not more than that)

Let me explain, for example.

I have a some HTML files which link to some Audio files for some chapters for different translaters, but the topic is the same, now I have more than 114 chapters with 10 different translators, that makes 1,140 of HTML files of which all of them have the same data exept the link that they point to, I have no problem using arrays and I could fetch the links (target URL) in a string variables and use them whereever I need them.

Now, this can also be solved just using the parameters, in this case only 2 HTML files (or maybe 1 HTML file) will do the work of all of those 1,140 HTML, by just passing chapter number and traslator ID to the html files. ( I would select this options from the Dropdown menu "<select>" the form should be submited when the list changes)

I just should know how to pass the parameter to the same file, that is [B]listen.html[/B] will be the only html file and on list change the parameters are passed to the same [B]listen.html[/B] like

[B]listen.html?chapterNo=2&traslatorsID=3[/B]

Now when the parameters are passed, it would again load the [B]same listen.html[/B] which should identify that parameters are passed and it should send the parameters to some javascript function which would do the rest.

you following me?

The Point here is, the file is passing the parameters to itself, and a Javascript is identifying that there are parameters passed to this HTML file and they are calling a another javascript function!!

Any Ideas?
Copy linkTweet thisAlerts:
@urxlncFeb 22.2003 — Well, let me explain again, I am just expressing my ideas...

  • 1. To send the parameters to the same file, I don't think you need to give the file name in the form to where the parameters are to be submitted, but just submit, now how can I submit the form when the list changes?


  • 2. I may use a simple code to find out weather the parameters are passed to the file...


  • function findParam(){

    var paramAt = document.location.indexOf("?");

    if (paramAt==-1) {

    alert("No Parameters) ;

    } else {

    alert("Parameters present);

    }

    }

    Now is there any other way (built-in) to find weather the parameters are present or not?

  • 3. How can I use the parameter? for example, the parameters passed are of same name as the object in the file (remember! we are submitting to the same file), should I have to again use the indexOf on the document.location and substring it to find the parameter value? or can I just use the parameter name (also object name) as the variable?
  • Copy linkTweet thisAlerts:
    @jbetts1967authorFeb 22.2003 — [i]Originally posted by khalidali63 [/i]

    [B]The link I gave you uses the URL to pass the one pges values to another.

    I thought you might get the idea,I guess not.



    to pass a variable to another page or to the same page for that matter you use this syntax.



    var someVar = "this is some value"



    window.location.href = window.location.href+"?"+someVar ;



    This will pass this variable value to itself.You will see this in location bar.





    window.location.href = "nextPage.html?"+someVar ;



    This will pass it to the next page.



    cheers



    Khalid [/B]
    [/QUOTE]


    is the reference below how it is used? if os in the receiving page how is the variable "gallery_dir" recieved?

    <td width="5%" align="center"><img name="pic1" SRC="graphics/miscgraphics/blank.gif"

    width="10" height="10" border="0"><br><a HREF="graphics/goldberggallery00/goldbergphotos01.htm?gallery_dir=../goldberggallery/"

    onMouseOver="changeIt('img2', 'http://www.fortunecity.com/millennium/rosieandjim/428/goldberg/goldberggallery01/goldberg0001.jpg')"

    target="_new"><img src="graphics/buttons/goldberggallerybuttonnumber01.jpg" width="50" height="30" border="0"

    class="opacity1" onMouseOver="imgover(pic1) ;playSound(8) ;this.className='opacity2'"

    onMouseOut="imgout(pic1) ;stopSound(8) ;this.className='opacity1'" alt="Goldberg Gallery number 1"></a><br>

    <strong><font color="#FF0000">0001</font></strong><br>

    <strong><font color="#FF0000">to</font></strong><br>

    <strong><font color="#FF0000">0300</font></strong></td>
    Copy linkTweet thisAlerts:
    @jbetts1967authorFeb 23.2003 — [i]Originally posted by Dave Clark [/i]

    [B]The following demonstration also uses a sending FORM, but the FORM is immaterial --

    it is the URL query string that is the important part. In this demonstration, however,

    you'll find the JavaScript in the second and third pages that is performing the actual work:



    http://www.DaveClarkConsulting.com/research/send_from.html



    [b]Dave[/b] [/B]
    [/QUOTE]


    Dave,

    your form example works the way i need it to, my question is this, Look at the following:

    <td width="5%" align="center" bgcolor="gold" class="dhtmlbutton"

    onMouseup="upeffect(this)" onMousedown="downeffect(this)"

    onmouseover="upeffect(this)" onmousedown="normaleffect(this)">

    <img name="pic1" SRC="graphics/miscgraphics/blank.gif" width="10" height="10" border="0"><br>

    <a HREF="graphics/goldberggallery00/goldbergphotos01.htm?gallery_num=1"

    onMouseOver="changeIt('img2', 'http://www.fortunecity.com/millennium/rosieandjim/428/goldberg/goldberggallery01/goldberg0001.jpg')"

    target="_new"><img src="graphics/buttons/goldberggallerybuttonnumber01.jpg" width="50" height="30" border="0" class="opacity1"

    onMouseOver="imgover(pic1) ;playSound(8) ;this.className='opacity2';"

    onMouseOut="imgout(pic1) ;stopSound(8) ;this.className='opacity1';"

    alt="Goldberg Gallery number 1"></a><br>

    <strong><font color="#FF0000">0001</font></strong><br>

    <strong><font color="#FF0000">to</font></strong><br>

    <strong><font color="#FF0000">0300</font></strong></td>


    how can I get the form to work with the above layout? When i click on the button thats when i want it to send the gallery_dir variable to the next page. I dont need the gallery_dir to be typed as the way to send the information, but sent when the button is clicked on? If I change the <a href> command to <input ...> will it work the same way?

    thanks,

    JB...
    Copy linkTweet thisAlerts:
    @urxlncFeb 23.2003 — To send the parameters to the same file, I don't think you need to give the file name in the form to where the parameters are to be submitted, but just submit, now how can I submit the form when the list changes? [/QUOTE]

    My question was...

    Consider this...

    <select name = "xyz" onChange="someFunction();">

    In the above, when the list changes, a javascript function "someFunction" is called. Now.

    <input type="submit" value="Submit">

    In the above, when the submit button is pressed, the form is submitted, right?

    Well how can I submit the form when the list "xyz" changes?
    ×

    Success!

    Help @jbetts1967 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.12,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...