PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] PHP and Javascript Input Field Validation

 February 08, 2022     javascript, lamp, php, validation     No comments   

Issue

i got a LAMP enviornment.

Imagine the following scenario:

<form method="post" name="" id="" onsubmit="javascriptValidateFormUserInputs()">
...
</form>

As the name already says the javascriptValidateFormUserInputs(), validates inputs done by the user. If they are ok true is returned otherwise false.

If i manipulate the html clientside to onsubmit="true" no validation is done and the users invalid data is sent to the database.

I want to prevent that of course.

What to do ?

Thanks


Solution

If you are using php, then server-side validation is always better as client side validation can be tampered with.

So you just need to check if $_POST("variable") has been validated otherwise return an error.

You may follow this example - PHP Form Validation



Answered By - malta
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing