php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20491 Problem with using Javascript inside a Switch()
Submitted: 2002-11-19 04:31 UTC Modified: 2002-11-19 04:33 UTC
From: langestaart_spijkers at hotmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4.2.3 OS: Apache 2.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
49 + 37 = ?
Subscribe to this entry?

 
 [2002-11-19 04:31 UTC] langestaart_spijkers at hotmail dot com
In my header and footer i've got the HTML for the layout of my site.

include_once("$root/includes/header.php");

switch($mode)
  {
  case "newmap":
  include("$root/docent/newmap.php");
  break;
  }

include_once("$root/includes/footer.php");

inside the file newmap.php if got the php-code that i use for the site inside this code ive got some error-windows for the users. I use the script below to call them inside the file newmap.php

if (mysql_num_rows (mysql_query("SELECT pparent FROM pagina WHERE pparent ='$menu->id'"))>0)
   {
    ?>
    <script language="JavaScript">
    name = "<? echo $menu->name; ?>";   
    window.alert("Cannot remove'"+name+"'..!  This map has one or more submaps, remove this first....!!")	
   </script>
   <?
   }

My problem is that in this switch structure the javascript runs first and i get a window but my site disapears (loses the header and footer) and when i push "ok" in the window it jumps back to the php. including header and footer again does not work. 
 
When i do this with a if else-statement i haven't got this problem. And i see the whole site with a javascript window in front. Is this a bug?? 

Thanx anyway Greetings Ivan Spijkers


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-19 04:33 UTC] jan@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.
 [2002-11-19 04:39 UTC] langestaart_spijkers at hotmail dot com
Well i guess it is an bug....because why can a piece of code be handled different in a switch() than in a if else-statement. I have looked on all supportplaces and i've got a thick book over PHP but i can't find any logic explanation..hmmm thanks anyway
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Jul 04 02:05:45 2022 UTC