Forum Moderators: coopster

Message Too Old, No Replies

PHP script causing a page error

I can't track down this error, anyone want to give it a try?

         

mikejson

6:08 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



Here is the code
<?php
$monthtemp = (int)date("n");
$yeartemp = (int)date("Y");
$datetemp = (int)date("j");
if( $monthtemp >= 9 ){
$OPN = $yeartemp + 1;
}
else{
$OPN = $yeartemp;
}
echo( '<input type="hidden" name="OPNyear" value="'.$OPN.'7">' );
echo( $OPN );
echo( '-7');
echo( '<input type="text" name="OPNnumber" id="OPNnumber" size="5" maxlength="5" onkeypress= "moveNextField( OPNnumber, 5, OPNnumber2)" >-<input type="text" id="OPNnumber2" name="OPNnumber2" size="1" maxlength="1" >');
?>

Now the Javascript function is like this
function moveNextField( fromField, number, toField ){
if( fromField.length > (number-1) ){
toField.focus();
}
}

the toField.focus() isn't the problem, cause I //comment it out, and it still gives the error

and the resulting code on the page from the php echos are like this:

<input type="hidden" name="OPNyear" value="20037">2003-7<input type="text" name="OPNnumber" id="OPNnumber" size="5" maxlength="5" onkeypress= "moveNextField( OPNnumber, 5, OPNnumber2)" >-<input type="text" id="OPNnumber2" name="OPNnumber2" size="1" maxlength="1" >

lorax

6:33 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What's the error?

mikejson

7:29 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



HAH Oops, forgot that part....

It says, error on line XX
Expecting an object.

Basically the line XX is right at the starting of the <?php tag, so I'm guessing since it's a IE error, then it would have to be an error in the actual tags, and not the php part. I know it's printing exactly what it should be from the php echos(see the previous post for what it does print in the "view source" of the page)

jatar_k

7:32 pm on Aug 8, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it sounds like a js error

have you tried using the js debugger in moz? just type javascript: into the location bar and hit enter. It will give you the exact error line.

panic

7:45 pm on Aug 8, 2003 (gmt 0)

10+ Year Member



I'm not a JS guy at all, but isn't JS really picky when it comes to syntax? It could be that it's missing an else statement (though I doubt it).

Take this as a grain of salt, but it might just work.

-panic

mikejson

5:54 pm on Aug 11, 2003 (gmt 0)

10+ Year Member



hmm, ok I'll post it on a Javascript board as well :)