Jump to content

Pass Javascript variable to PHP page


AshleyByrom

Recommended Posts

Okay so I have set up a little skins function on my website that works fine.

 

There is a jump menu with two values inside it. The values are blue and pink.

 

When blue is selected you are sent to executeBlue.php

When pink is selected you are sent to executePink.php

 

the execute pages then need to change the skin (which they do) and then send you BACK to the page you were viewing. That is where I am stuck. Using the following code I have managed to store the page name inside a javascript variable.

 

<script language="javascript">
var sPath = window.location.pathname;
//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
</script>

 

so sPage stores the page name. I would like to link to each of the execute files so instead of sending you to executeBlue.php you are sent to executeBlue.php?page=sPage

 

How could this be done?

 

<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
            <option>Skin</option>
            <option value="executeBlueSkin.php?page=">Blue</option>
            <option value="executePinkSkin.php">Pink</option>
          </select>

 

there's my jump menu code if it helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.