Hi there,
Although this is a basic question, but for me is a big program, basically I need to get a variable from a JAVASCRIPT statement, this is the scenario.
I have written down a script to validate a Input screen, user, password and so for, well I am stoping my program every time the script found at least one blank field, but I need to execute a program to validate if the record added already exist in my MYSQL database, the problems is that I need to be sure that the previous step has been finished without any error, if so I will call my sql satement to check for a duplicated data, What I need?
I need to bring fron the script a kind of variable that could have True or Flase, if that variable is false then I will call my sql othewise i will keep validating for blanks
Problably I am worng with my logic,. so I really apreciate your coments
thanks in advance
Rigo
JavaScript and PHP
Moderator: General Moderators
Re: JavaScript and PHP
Don't rely on Javascript when writing your PHP. While its all fine and nice and pretty to have Javascript validators you're just asking for trouble since you'll inevitably run into someone who has Javascript turned off. Perform your JS validations, then go ahead and redo them in PHP. It sounds redundant but its absolutely necessary.
Re: JavaScript and PHP
So you recomend do not use Javascript?
I willl try or redo my program to handle the whole of validation with PHP
I willl try or redo my program to handle the whole of validation with PHP
Re: JavaScript and PHP
You can use Javascript on your web page - just don't rely on it to handle your validation.
-
harrymanjan
- Forum Newbie
- Posts: 2
- Joined: Mon Dec 07, 2009 11:03 pm
Re: JavaScript and PHP
Very true. But it might be easier to design your form validation on php first, then on javascript.
Ensure your server-side validation works, then client-side validation.
Else you have to turn off javascript to test php side validation when developing.
Ensure your server-side validation works, then client-side validation.
Else you have to turn off javascript to test php side validation when developing.