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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:51:35+00:00 2026-05-16T10:51:35+00:00

This is a two part question, but I want to make sure the first

  • 0

This is a two part question, but I want to make sure the first is actually achievable.

Firstly, can you get access variables set by img src? I am attempting jQuery, including MySQL UPDATE etc, but this I needed to make sure would work?

<a href="#" class="chnge"><img src="filename.jpg?id=1&open=1" /></a>

The jQuery would then have something similar to:

      $("img#chnge").click(function() {

        var id      = $('#id').attr('value');
        var open    = $('#open').attr('value');
            $.ajax({
                type: "POST",
                url: "update.php",
                data: "id="+ id +"& open="+ open,
                success: function(){
                    $('img#chnge').fadeTo('slow',0.4);

                }
            });
        return false;
        });

I hope it is obvious, basically, I have an image, if it’s “open” is set to 1, when you click it the opacity changes, but it would also send off a query to my update.php.

I know where the errors are in this form, I just dont know how to fix them. #1 = variables in the img src (i dont know if i can put them in the href instead?), and the 2nd is the $(‘#id’) and $(‘#open’) I don’t think are correct, but I don’t know what to change them to either.

Any assistance would be much appreciated.

Phillip.

UPDATE: After reading Otars reply, I thought I had better add the full code re: how the images are to be where they are…

Thank-you. Because these images are being generated through a for() loop (php), is that going to have an affect on how this code will work?

<?php
$query = mysql_query("SELECT * FROM catalogue");
$num = mysql_num_rows($query);

for ($x=1;$x<=$num;$x++) {

  $row = mysql_fetch_row($query);

  ?>

  <a href="#" id="chngeHref" /><img src="<?php echo $row[2]; ?>?id=<?php echo $row[0]; ?>&open=<?php echo $row[1]; ?>" id="chnge" /></a>

<?php

  /* row[0] = id 
     row[1] = open (1 or 0)
     row[2] = image url
  */

  }

?>
  • 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-16T10:51:36+00:00Added an answer on May 16, 2026 at 10:51 am

    Anyway your image has to be a PHP script…

    Pass GET parameters to it, do whatever you want in the script and then output the image like this:

    Let’s say file is called image.php

    <?php
    
        $par = $_GET['test'];
    
        // Do some PHP related job here
    
    
        // Load the image
        header('Content-Type: image/jpeg');
        header('Location: /path/to/your/image.jpg');
    
    ?>
    

    Then use it like this: <img src="image.php?test=value">

    It gonna call the PHP script first and then display image.

    • 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.