Forum Moderators: coopster

Message Too Old, No Replies

PHP MySQL - error on page on "Submit"

Suspect form variables are not passed on correctly?

         

mlkarie

12:31 pm on Aug 10, 2003 (gmt 0)

10+ Year Member



New to PHP and MySQL; created my own database, and wrote a PHP script to access and display the contents of the file. Was most exciting when it worked. :-) :-)

Now I'm at the place where the user enters name and password; database is to be searched, if found, user is logged on.

However, I get an "Error on page" in the bottom left hand corner of Internet Explorer, when I click on the Submit button of the form where name and password is entered.

Have commented out all database accessing code, and still get the error, so I'm wondering if the error comes from where the form variables are passed on. (I'm also new to writing forms.

Please can you help? I'm using PHP4.

brotherhood of LAN

12:39 pm on Aug 10, 2003 (gmt 0)

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



AFAIK PHP wont give you that error in IE, are you using javascript on the page? Just a hunch but that could be it.

vincevincevince

12:58 pm on Aug 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It is most likely to be javascript.
View the source of the page which gives the error (on seeing the error) and read it with care.
What is the error by the way? (Double click the (!) in IE to get the error description).

mlkarie

2:23 pm on Aug 10, 2003 (gmt 0)

10+ Year Member



Error code says:

Line: 28
Char: 3
Error: Function expected
Code: 0

I'll go and look at line 28 of my code; will report back, thanks.

mlkarie

2:48 pm on Aug 10, 2003 (gmt 0)

10+ Year Member



Difficult to find the line 28 that IE refers to.

Javascript is used to validate the form. It works fine with giving error messages (e.g. password too short) - the error comes when a valid user name and password is entered.

The Javascript is like this:

var saveit=true;

if %test1%
then saveit = false;
... and so on, various tests

//else // i.e. no errors found

else if (saveit) submit();

Is that submit() correct?

Actually what I can also try, is to take out the Javascript altogether for now (i.e. don't check for errors), and just see if the username gets passed on to the next php file.

mlkarie

3:03 pm on Aug 10, 2003 (gmt 0)

10+ Year Member



Thanx a stack! You were right about the Javascript. What I've just done, is change the button action (which called the validate_form code), to just do a submit()

i.e. NAME="Login_button" VALUE="Login" ONCLICK="submit()"

and the "Error on page" has disappeared!

(And nothing else happens, because I've commented it all out to try and find the mistake, no I must get back to what was supposed to happen when this button gets pressed).

Thanks for the help.

vincevincevince

4:26 pm on Aug 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm glad you're on the track to success. One observation I have is that maybe you neglected to output all the javascript you should have in 2nd page?

jatar_k

4:35 pm on Aug 10, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I think the submit() is wrong.

try it with
document.formname.submit();

instead and see if that works.