JavaScript and client side scripting.
Moderator: General Moderators
valen53
Forum Contributor
Posts: 137 Joined: Tue Aug 27, 2002 9:29 am
Post
by valen53 » Thu Oct 02, 2003 2:24 am
Testing PC.
PC1 : w2k, IE5 ;
PC2 : win98 IE6
alert1.php
Code: Select all
<?
if ( $Submit == 'Submit' ) {
echo'
<script language="JavaScript1.2">
alert("Data updated ! ");
</script>';
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="post" action="alert1.php">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
PC1 : correctly, alert the message one time
PC2 : wrongly, alert the message twice time
anybody face this problem b4 ? is it IE6 setting problem ?
Derfel Cadarn
Forum Contributor
Posts: 193 Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany
Post
by Derfel Cadarn » Thu Oct 02, 2003 8:10 am
After changing one line into the following:
Code: Select all
<?php
if ( $_POST['Submit'] == 'Submit' ) {
?>
it worked fine in Mozilla with me.
igoy
Forum Contributor
Posts: 203 Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:
Post
by igoy » Thu Oct 02, 2003 8:12 am
well... will and without register_globals on..
when i tested this code on XP system with ie6 (sp1).. it worked fine..
I suppose your problem must be with your ie6 settings.
scorphus
Forum Regular
Posts: 589 Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:
Post
by scorphus » Thu Oct 02, 2003 10:21 am
Make PHP to write the <script...>...</script> tag inside <head> tag. I may be the reason why PC2 wont display the alert. Changed to:
Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
if ( $Submit == 'Submit' ) {
echo'
<script language="JavaScript1.2">
alert("Data updated ! ");
</script>';
}
?>
</head>
<body>
<form name="form1" method="post" action="alert1.php">
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
The <script> was before <html> tag and it doesn't complies with standard HTML specification.
Cheers,
Scorphus.
m3rajk
DevNet Resident
Posts: 1191 Joined: Mon Jun 02, 2003 3:37 pm
Post
by m3rajk » Thu Oct 02, 2003 1:39 pm
i'm going to have to agree with scorphus for two reasons:
1: it's better to conform to standards since it makes your site more widely compatable, and may cause issues like that if you don't.
2: when i had an issue with javascript he fixed it in about 30 seconds, so he obviously knows it, and from what i've seen looking around this forum, he knows it well
valen53
Forum Contributor
Posts: 137 Joined: Tue Aug 27, 2002 9:29 am
Post
by valen53 » Fri Oct 03, 2003 1:54 am
it was working when changing the code like
Code: Select all
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
if ( $Submit == 'Submit' ) {
echo'
<script language="JavaScript1.2">
alert("Data updated ! ");
</script>';
}
?>
</head>
thanks for reply
igoy
Forum Contributor
Posts: 203 Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:
Post
by igoy » Fri Oct 03, 2003 2:14 am
Head.. HEAD... HeAd.... eeeeeeeeeeeeeee..
why the hell that didn't occured to me ??????....
first.. I was stupid enough to think there is no problem with it since it ran properly on my system.
second.. rule braking has got me so much that i have started to forget thing called "standard"
dobby musdt punish himself... err.. yogi must punish himself....