Note that there are some explanatory texts on larger screens.

plurals
  1. POIE8 Php header location opens a new window
    text
    copied!<p>I have a page dynamically filled with content from PHP and databases, the content is loaded into an iframe. Now when I make a custom search, the results are coming out fine on all browsers BUT IE8 (and maybe earlier versions). The browser sorts the results in a new window instead of filling the iframe!</p> <p>my php search page:</p> <pre><code> &lt;?php if (isset($_REQUEST[searchname])) { $searchname = $_REQUEST[searchname]; if (strlen($searchname) &lt; 3) { $location = "necrologies_iframe.php?action=tooshort"; header("Location: {$location}"); } else { $location = "necrologies_iframe.php?action=search&amp;nom={$searchname}"; header("Location: {$location}"); } } ?&gt; </code></pre> <p>Is there a way to fill the iframe with results instead of opening a new window?</p> <h2>Edit</h2> <p>The search form/button:</p> <pre><code>&lt;form id="form1" name="form1" method="get" target="frame" action="http://www.cablevision.qc.ca/fr/code/necrologies_search.php"&gt; &lt;p&gt;&lt;strong&gt;&lt;a href="javascript:void(0);" onClick="necro_search('est');" &gt;Abitibi-Est&lt;/a&gt; | &lt;!--//href="index.php?option=com_content&amp;amp;view=article&amp;amp;id=123&amp;amp;Itemid=146&amp;amp;action=est--&gt; &lt;a href="javascript:void(0);" onClick="necro_search('ouest');" &gt;Abitibi-Ouest&lt;/a&gt; | &lt;!--//href="index.php?option=com_content&amp;amp;view=article&amp;amp;id=123&amp;amp;Itemid=146&amp;amp;action=ouest"--&gt; &lt;a href="javascript:void(0);" onClick="necro_search('rn');" &gt;Rouyn-Noranda&lt;/a&gt; | &lt;!--//href="index.php?option=com_content&amp;amp;view=article&amp;amp;id=123&amp;amp;Itemid=146&amp;amp;action=rn"--&gt; &lt;a href="javascript:void(0);" onClick="necro_search('temis');"&gt;T&amp;eacute;miscamingue&lt;/a&gt; &lt;!--//href="index.php?option=com_content&amp;amp;view=article&amp;amp;id=123&amp;amp;Itemid=146&amp;amp;action=temis"--&gt; &lt;/strong&gt; | &lt;input name="searchname" type="text" id="searchname" value=&lt;?php if (isset($_REQUEST[nom])) { echo '"' . $_REQUEST[nom] . '"'; } else { echo '"rechercher les archives"'; } ?&gt; size="25" /&gt; &lt;input type="submit" name="submit" id="submit" value="Rechercher" /&gt; </code></pre> <p>The iframe part of the page</p> <pre><code>&lt;iframe id="frame" "width="638px" frameborder="0" src="code/necrologies_iframe.php" scrolling="yes" horizontalscrolling="no" verticalscrolling="yes"&gt;&lt;/iframe&gt; </code></pre> <p>the iframe page code</p> <pre><code> &lt;style type="text/css"&gt; &lt;!-- table { line-height: 135%; font-family: Arial, Helvetica, sans-serif; font-size:13px; } .border { border: 1px solid #000000; } .borderbas { border-bottom: 1px solid #000000; } .padding { padding: 5px; } --&gt; &lt;/style&gt; &lt;?php // fichier de connection a la DB require_once("includes/connection.php"); require_once("includes/functions.php"); ?&gt; &lt;?php $action = $_REQUEST[action]; $datedujour = date("Y-m-d"); switch ($action) { case "search": $searchname = utf8_decode(mysql_prep($_REQUEST[nom])); $necroresult = mysql_query("SELECT * FROM necrologies WHERE nom LIKE '%{$searchname}%' AND approuve = '1' ORDER BY id DESC "); if (mysql_affected_rows() == 0) { // message que je fais afficher si il ne trouve rien (au lieu d'une page blanche qui ne veux rien dire $message = "&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Aucun r&amp;eacute;sultat trouv&amp;eacute; &lt;/h3&gt;&lt;br&gt;Veuillez modifier le nom de la recherche...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"; } else { // sinon on affiche le nombre de resultats trouvés $necro_num_rows = mysql_num_rows($necroresult); $message = $necro_num_rows . " r&amp;eacute;sultat(s) trouv&amp;eacute;s..."; $affiche_liste = 1; } break; case "tooshort": echo "&lt;br&gt;&lt;br&gt;&lt;center&gt;Recherche trop courte, veuillez entrer plus de 4 caract&amp;egrave;res...&lt;/center&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;"; break; case "est": case "ouest": case "rn": case "temis": $affiche_liste = 1; // pour faire afficher la liste des necro $necroresult = mysql_query("SELECT * FROM necrologies WHERE datefin &gt; '{$datedujour}' AND approuve = '1' AND region = '{$action}' ORDER BY id DESC "); break; default: // default on vois toutes les necro de toute les regions $necroresult = mysql_query("SELECT * FROM necrologies WHERE datefin &gt; '{$datedujour}' AND approuve = '1' ORDER BY id DESC "); $affiche_liste = 1; } ?&gt; &lt;br /&gt; &lt;?php // affichage du message if (isset($message)) { echo "&lt;br&gt;&lt;strong&gt;&lt;center&gt;" . $message . "&lt;/strong&gt;&lt;/center&gt;&lt;br&gt;"; } // liste des necro dans des tables if ($affiche_liste == 1 || !isset($_REQUEST[action])) { while ($row = mysql_fetch_array($necroresult)) { ?&gt; &lt;!-- Debut de la table fancy round corner --&gt; &lt;div align="center"&gt; &lt;table border="0" align="left" cellpadding="0" cellspacing="0" class="tb"&gt; &lt;tr&gt; &lt;td width="16"&gt;&lt;img src="/fr/images/roundtable/top_lef.gif" width="16" height="16"&gt;&lt;/td&gt; &lt;td height="16" background="/fr/images/roundtable/top_mid.gif"&gt;&lt;img src="/fr/images/roundtable/top_mid.gif" width="16" height="16"&gt;&lt;/td&gt; &lt;td width="24"&gt;&lt;img src="/fr/images/roundtable/top_rig.gif" width="24" height="16"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="16" background="/fr/images/roundtable/cen_lef.gif"&gt;&lt;img src="/fr/images/roundtable/cen_lef.gif" width="16" height="11"&gt;&lt;/td&gt; &lt;td align="center" valign="middle" bgcolor="#FFFFFF"&gt; &lt;!-- Debut du content de la table fancy round corner --&gt; &lt;table width="576" border="0" cellspacing="0" cellpadding="0" class="border" &gt; &lt;tr &gt; &lt;td rowspan="2" valign="top"&gt;&lt;img src="/fr/images/necrologies/&lt;?php echo utf8_encode($row['photo']); ?&gt;" alt="photo" /&gt;&lt;br&gt;&lt;a href="necrologies_print.php?id=&lt;?php echo $row[id]; ?&gt;" target="_blank"&gt;&lt;img src="/fr/images/cnq/imprimable.gif" border="0" width="150" height="50"&gt;&lt;/a&gt;&lt;/td&gt; &lt;td width="200" bgcolor="#DFEFFF" class="borderbas" style="border-left: 1px solid #000000; border-right: 1px solid #000000"&gt;&lt;center&gt;&lt;?php echo nl2br(mb_convert_encoding($row['nom'], "UTF-8", "Windows-1252")); ?&gt;&lt;/center&gt;&lt;/td&gt; &lt;td bgcolor="#DFEFFF" class="borderbas"&gt; &lt;center&gt; &lt;strong&gt; &lt;?php $maison = $row[maison]; if ($maison == "N/D") { echo "(information non disponible)"; } else { if (substr($maison, 0, 6) == "La dir") { echo utf8_encode($maison); } else { echo "La direction des fun&amp;eacute;railles a &amp;eacute;t&amp;eacute; confi&amp;eacute;e &amp;agrave;/aux &lt;br&gt;"; echo utf8_encode($maison); } } ?&gt; &lt;/strong&gt;&lt;/center&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="border-left: 1px solid #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;" colspan="2"&gt;&lt;div class="padding" align="left"&gt;&lt;?php echo nl2br(mb_convert_encoding($row['description'], "UTF-8", "Windows-1252")); ?&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;!-- Fin du content de la table fancy round corner --&gt; &lt;/td&gt; &lt;td width="24" background="/fr/images/roundtable/cen_rig.gif"&gt;&lt;img src="/fr/images/roundtable/cen_rig.gif" width="24" height="11"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="16" height="16"&gt;&lt;img src="/fr/images/roundtable/bot_lef.gif" width="16" height="16"&gt;&lt;/td&gt; &lt;td height="16" background="/fr/images/roundtable/bot_mid.gif"&gt;&lt;img src="/fr/images/roundtable/bot_mid.gif" width="16" height="16"&gt;&lt;/td&gt; &lt;td width="24" height="16"&gt;&lt;img src="/fr/images/roundtable/bot_rig.gif" width="24" height="16"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;!-- Fin de la table fancy round corner --&gt; &lt;!--[if IE 8]&gt; &lt;style type="text/css"&gt; .tb{ float:left; align:left; width:550px; scrolling-horizontal:none; } &lt;/style&gt; &lt;![endif]--&gt; &lt;!--[if IE 7]&gt; &lt;style type="text/css"&gt; .tb{ float:left; align:left; width:550px; scrolling-horizontal:none; } &lt;/style&gt; &lt;![endif]--&gt; &lt;!--[if IE 6]&gt; &lt;style type="text/css"&gt; .tb{ float:left; align:left; width:550px; scrolling-horizontal:none; } &lt;/style&gt; &lt;![endif]--&gt; &lt;br /&gt;&lt;br /&gt; &lt;?php } } ?&gt; &lt;?php // close la connection mysql_close($connection); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload