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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:46:38+00:00 2026-05-20T02:46:38+00:00

I’m working on a little something that will be part of an e-commerce website

  • 0

I’m working on a little something that will be part of an e-commerce website for an assignment. You will probably look at it and think I should just do it with JS, but we’re told to use hardly any JS, and instead favor PHP especially when querying the SQL tables.

I’m building something where when a user mouseOvers() any of the images in the catalogue, a general iFrame refreshes with information based on the image that has the current focus – it does this by querying the database using a variable upon being loaded. This is where I’ve used JS to submit the form that refreshes an iFrame and, as PHP is parsed server side, upon being refreshed the information can be loaded seemingly dynamically to the user.

It all seems to be working except from the fact the target iframe does not get updated, but instead the page is loaded in a new tab or window in my browser (Firefox). NOTE: This code is a rough draft!

<div class="contentpane">


<div class="image1" onMouseOver="jsFunction();" onMouseOut="jsFunction2();">
    <img src="http://t0.gstatic.com/images?q=tbn:ANd9GcStRUHQMqvpCvdCyEwkO9DFxy0IY9fg1CP3uePBktHRMz8QznlQ" width=100 height=100/>

</div>

<div class="image2">
</div>

<div class="image3">
</div>

<script>
function jsFunction(){

    document.forms['testform'].elements['i1'].value =  "mouseOver";
    document.forms["testform"].submit();
    // force refresh on Mouse Over
    /*var f = document.getElementById('testiframe');
    f.contentWindow.location.reload(true);*/

}

function jsFunction2(){

document.forms['testform'].elements['i1'].value = "mouseOut";
document.forms["testform"].submit();

}

</script>


<iframe src="iframetest.php" id='testiframe' width="200" height="200">
<!-- using this roundabout way with iframes so that all interaction with SQL is via PHP and not JS-->
</iframe>

<!-- hidden form that has a target of the iframe, submitted by the js functions-->
<form id="testform" method="GET" target="testiframe" action="iframetest.php" >
    <input type="hidden" id="i1" name="i1" value="hey"> <!-- retrieved in php file by $_GET-->
</form>

And the code for iframetest.php is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="style.css" />
<title>Home</title>
</head>

<body>

Dynamic content, will be pulled from SQL via PHP <br/> <br/>


<?php 
if(isset($_GET)){
echo $_GET["i1"];
} 
?>

Thanks for your help guys!

  • 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-20T02:46:39+00:00Added an answer on May 20, 2026 at 2:46 am

    This task is screaming for ajax from miles away , but anyway here it goes:
    The content is getting displayed in a new page/tab is becouse you didn’t specified the iframe name so you’re code should look like this :

    <iframe src="iframetest.php" name="testiframe" width="200" height="200">
    <!-- using this roundabout way with iframes so that all interaction with SQL is via PHP and not JS-->
    </iframe>
    
    <!-- hidden form that has a target of the iframe, submitted by the js functions-->
    <form id="testform" method="GET" target="testiframe" action="iframetest.php" >
        <input type="hidden" id="i1" name="i1" value="hey"> <!-- retrieved in php file by $_GET-->
    </form>
    

    p.s. notice the change in on the iframe tag from id='testiframe' into name="testiframe"

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into

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.