Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP and JavaScript

Status
Not open for further replies.

ESchmidgall

Technical User
Aug 8, 2005
3
CH
Hello!

I am working on a database-querying script in php. It was all set up and working fabulously when I decided to make the "database information entry" form a dynamic form, since whether or not information is required in some fields depends on what is selected on the SELECT menu. To make the form dynamic, I added in a few lines of JScript, a standard form-validating function:

<script>
function CheckForm(){

if(document.insertform.locatoin_.selectedIndex ==5){
document.getElementsByName("otherloc_")[0].disabled="";
}
else{
document.getElementsByName("otherloc_")[0].disabled="disabled";
}

...and so on

}
</script>

Anyway, now that I've added in this, the php stuff that was working so beautifully before doesn't work at all. None of the queries to mySQL come back correctly, nothing gets put in the database correctly. Is there a step to integrating php and JScript that I have forgotten? Is it even possible to integrate php and JScript form validation? IF not, is there a way of doing this in php?

Thank you very much!
 
"document.insertform.locatoin_."
"locatoin"? Is that right?


As a general rule I always perform data-validation in PHP and never in a client-side scripting language. You never know when a user has configured his web browser to have client-side scripting turned off.

IF not, is there a way of doing this in php?
I dunno. What are you trying to do?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top