Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 567985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:08:30+00:00 2026-05-13T13:08:30+00:00

I am working on a project which involves moving products around a virtual living

  • 0

I am working on a project which involves moving products around a virtual living room, I have the following function


<a href="javascript:void(0)" onclick="sendxandy( <? echo $_SESSION['numberOfProducts']; ?> )">Save Positions of Products</a>

and then the function is as follows:

`
function sendxandy(productAmount)
{
       if (productAmount == 1)
       {
   location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y;
       }
       if (productAmount == 2)
       {
   location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y + 
   "&xtwo= " + dd.elements.image2.x + "&ytwo=" + dd.elements.image2.y;
       }
       if (productAmount == 3)
       {
   location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y + 
   "&xtwo= " + dd.elements.image2.x + "&ytwo=" + dd.elements.image2.y + 
   "&xthree= " + dd.elements.image3.x + "&ythree=" + dd.elements.image3.y;
       }
       if (productAmount == 4)
       {
   location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y + 
   "&xtwo= " + dd.elements.image2.x + "&ytwo=" + dd.elements.image2.y + 
   "&xthree= " + dd.elements.image3.x + "&ythree=" + dd.elements.image3.y + 
   "&xfour= " + dd.elements.image4.x + "&yfour=" + dd.elements.image4.y;
       }
       if (productAmount == 5)
       {
   location.href="homeview.php?x=" + dd.elements.image1.x + "&y=" + dd.elements.image1.y + 
   "&xtwo= " + dd.elements.image2.x + "&ytwo=" + dd.elements.image2.y + 
   "&xthree= " + dd.elements.image3.x + "&ythree=" + dd.elements.image3.y + 
   "&xfour= " + dd.elements.image4.x + "&yfour=" + dd.elements.image4.y +
   "&xfive= " + dd.elements.image5.x + "&yfive=" + dd.elements.image5.y;
}
`

and the function continues just like this up to image 10. so as you can see the coordinates of the image are saved in the URL so that I can access them in php, my next function is this

<a class="code" href="javascript:void(0);" onclick="moveProduct(<? echo $_SESSION['numberOfProducts']; ?>)">Move Images Back</a>

and inside here i have this (the moveTo variables are php variables for some reason this display can’t print the code, also the moveTo is another function which is provided by a second script):

`function moveProduct(moveAmount)
{
    if (moveAmount == 1)
    {   
        if(window.dd && dd.elements) 
        {
        dd.elements.image1.moveTo(, );
        }
    }
    if (moveAmount == 2)
    {   
        if(window.dd && dd.elements) 
        {
        dd.elements.image1.moveTo(, );
        dd.elements.image2.moveTo(, );
        }
    }
    if (moveAmount == 3)
    {   
        if(window.dd && dd.elements) 
        {
        dd.elements.image1.moveTo(, );
        dd.elements.image2.moveTo(, );
        dd.elements.image3.moveTo(, );
        }
    }

`
now i know my loop structure is god awful 🙂 but please bear with me. whats happens is inside the moveProduct function, whatever the last if “moveAmount == ” is, then images will only be relocated at that number. for example if I have the function set as above only three images will be remembered, not one or two, or four or five, but three only. i actually have ten items so i have the above functions set up for 10 items, and ONLY 10 images will be remembered. When i run the function moveProduct when theres not 10 items on the page, nothing happens at all like I’ll load one image, move it, click save, everything looks fine but when i move it back to remembered coordinates nothing happens.

please help any advice would be appreciated

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:08:30+00:00Added an answer on May 13, 2026 at 1:08 pm

    hey i figured it out, the php variables were returning blank values which made the js function fail entirely 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.