answersLogoWhite

0

How does validation work in PHP?

Updated: 9/14/2023
User Avatar

Wiki User

12y ago

Best Answer
NOTE : Copy This Code And Remove STEP=>1 And STEP=>.STEP=>1

STEP=>1

if(isset($_POST['email']))

{

$emal = $_POST['email'];

if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/",$emal))

{

echo "Valid E-mail";

}

else

{

echo "Invalid Valid E-mail";

}

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How does validation work in PHP?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Basic Math

Php Source code for validation?

If you wish to check the syntax of your source code, you need to run the code through the PHP CLI with the -l option. There are also some online resources to validate the syntax. This will check only the syntax of your file. This will not however detect runtime errors or logic errors. You must absolutely run the script for the best possible code validation.


What is syntax in php?

We can use php tags in different ways. <?php //php code to be written here ?> OR <? //php code ?> This tag will not work when we using editors such as macromedia dreamweaver. OR < script language="php"> //php code </script>


What are the five main types of validation checks?

types of validations are: required field validation range validation pattern matching validation database specific validation numeric validation


What is the difference between PHP and CGI?

The benefits of running PHP-CGI are:** It is more secure. The PHP runs as your user rather than dhapache. That means you can put your database passwords in a file readable only by you and your php scripts can still access it!* It is more flexible. Because of security concerns when running PHP as an Apache module (which means it runs as our dhapache user), we have disabled a number of commands with the non-CGI PHP. This will cause installation problems with certain popular PHP scripts (such as Gallery) if you choose to run PHP not as a CGI!* It's just as fast as running PHP as an Apache module, and we include more default libraries.There are a FEW VERY MINOR drawbacks to running PHP-CGI. They are:** Custom 404 pages won't work for .php files with PHP-CGI. Or will they? See n74's comment below!* Variables in the URL which are not regular ?foo=bar variables won't work without using mod_rewrite (http://httpd.apache.org/docs/mod/mod_rewrite.html) (example.com/blah.php/username/info/variable).* Custom php directives in .htaccess files (php_include_dir /home/user;/home/user/example_dir) won't work.* The $_SERVER['SCRIPT_NAME'] variable will return the php.cgi binary rather than the name of your script* Persistant database connections will not work. PHP's mysql_pconnect() function will just open a new connection because it can't find a persistant one.If one of those is a show-stopper for you, you can easily switch to running PHP as an Apache module and not CGI, but be prepared for a bunch of potential security and ease-of-use issues! If you don't know what any of these drawbacks mean, you're fine just using the default setting of PHP-CGI and not worrying about anything!


What is new in PHP?

PHP is a recursive acronym for "PHP: Hypertext Preprocessor" created by The PHP Group. PHP is a widely used server-side scripting language and the general purpose of PHP is to create dynamic Web Pages. For more information, visit the PHP website.

Related questions

How does form validation differ in JavaScript and PHP?

In JavaScript the validation is done client side, which means it can be easily bypassed by turning JavaScript off in your browser. But with PHP it is server side, which means you can't switch it off, so you can't bypass the validation.


How can you use the OR condition in PHP validation in regular expressions?

You use instead of OR


Php Source code for validation?

If you wish to check the syntax of your source code, you need to run the code through the PHP CLI with the -l option. There are also some online resources to validate the syntax. This will check only the syntax of your file. This will not however detect runtime errors or logic errors. You must absolutely run the script for the best possible code validation.


Does TCS use php?

All big companies work in PHP. It is a growing technology.....


Validating a form within Ajax tabs with PHP?

If you know jquery it will help to write javascript easily to accomplish, what is needed. There should not be any difficulties because the form is inside a ajax tab. if you will write on $(document).ready(function(){ // here all validation should work })


How can you put PHP into your product details pages?

<?php // your php code goes here ?> If your product pages are created in PHP (have the .php extension) then you can simply add the php start/end tag. There is a way to have the server recognize PHP inside of HTML files but that would require some work on the server, better left to the server manager.


What is a good server for PHP language?

The best server yet for php serving is Apache, as PHP and Apache work closely together. The MySQL community database is a good server for PHP applications, this is why we talk about w/xamp servers, Windows/Linux Apache MySQL PHP servers.


How can one become employed in a PHP job?

While it may be a bit harder to find a company to work for, you could always check your local listings on sites such as Monster. Another way is to become a freelance PHP programmer, taking up opportunities as they come. If you are hard pressed to find work, then check sites where people are asking for PHP work done, such as the website PHP Jobs.


Where can freelance PHP work be found?

There are many websites that you can go to in order to find freelance PHP work. Some of the more popular sites include Peopleperhour, Freelancer and Teams4hire.


How does PHP work?

PHP is a programming language that stands for PHP Hypetextual Processing (recursive acronym). Technically PHP is just a program that lives on your computer which interprets code and executes PHP statements line by line. The PHP interpreter will execute changes to your computer or run-time environment based on the low-level instructions that the programmer issues.


What is syntax in php?

We can use php tags in different ways. <?php //php code to be written here ?> OR <? //php code ?> This tag will not work when we using editors such as macromedia dreamweaver. OR < script language="php"> //php code </script>


What are the five main types of validation checks?

types of validations are: required field validation range validation pattern matching validation database specific validation numeric validation