• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 343
  • Last Modified:

Submitting for from iframe

Hi X-perts,

I have a main page main.php containg 2 iframes country.php and city.php. The last iframe city.php is sending a form to itself using $_SERVER['PHP_SELF']. Next, after city.php updates the database fields I use the following code to redirect the page:

$updateGoTo = "main.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));

===================================================
The problem is that it opens a new page, but I need to stay on my original main.php with those 2 frames. How can I do it?
This works fine for normal pages with no iframes, i.e. it updates the fields and remains on the same page, but iframes make this trouble. If I remove the above code, it opens a new city.php as a new page also.

Thank you,

Andy
0
andy7789
Asked:
andy7789
1 Solution
 
RoonaanCommented:
Do you have target="top" on your <form> tag?

Otherwise the city.php should just stick in its own frame.

-r-
0
 
andy7789Author Commented:
::)
Sorry, for a silly question! Of course, it was just a "blank" target onthe form ... just have not noticed it when copying from another template form!! Spent a few hours debugging php, and it was just this typo.

thanks a lot!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now