Link to home
Start Free TrialLog in
Avatar of andy7789
andy7789

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Roonaan
Roonaan
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andy7789
andy7789

ASKER

::)
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!!