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 8837335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:41:52+00:00 2026-06-14T09:41:52+00:00

I am trying my best to learn AJAX and passing these php variables through

  • 0

I am trying my best to learn AJAX and passing these php variables through to another php file. I am struggling though with some code.

Here is my problem. I have a button when onClick that does a javascript function

<input type='image' src='images/download-all.png' alt='Submit' onclick='download(".$y['imageURL'].")'>

The $y[‘imageURL’] is from code that pulls in results from a table.

$sql1 = "SELECT * FROM digital_materials WHERE id = '".$x['itemID']."'";
$res1 = mysql_query($sql1);
$y = mysql_fetch_assoc($res1);

Because I am running a while loop before hand I get two arrays back, that both have imageURL keys. I am partially using someone else’s code here, so if there is something just point it out.

Here is my download function.

function download(x)
    {
        $.ajax({
                url:'download.php',
                data:"image="+x,
                success:function(e){
                        alert("Hey, this worked.");
                },
                error:function(e, f, g){
                    alert("Error removing from cart, please try again. "+e+" : "+f+" : "+g);
                }
        });
    }

How do I pass both of these keys from the array to my php file to be processed? Right now it is just giving me this on my source code.

  • 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-06-14T09:41:53+00:00Added an answer on June 14, 2026 at 9:41 am

    You can send arrays in query strings like that

    image[first]=image.jpg&image[second]=image.png
    

    You will then be able to access each image through PHP super variable $_GET or $_POST depending on the method set on your ajax request (I think it’s $_GET by default with jQuery)

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

Sidebar

Related Questions

I am trying to fumble through python, and learn the best way to do
I'm trying to learn some graphics programming using C. What would be the best
I'm a newbie programmer doing his best to self learn PHP. I'm trying to
I'm trying to learn the best way to arrange/define code. Taking the below as
I'm trying to learn more about PHP security best practices, and I came across
I'm trying my best to learn MVC and cakePHP and I had a question
I'm trying to learn pygame, And I found the best way to have the
I am fairly new to Git and trying my best to find some documentation
im trying my best to learn LINQ but im still having a hard time
I'm new to databases and web development but I'm trying my best to learn

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.