Home  >  Article  >  Backend Development  >  Example of $_POST passing value in php

Example of $_POST passing value in php

WBOY
WBOYOriginal
2016-07-25 08:56:341414browse
This article introduces three small examples of using $_POST to transfer values ​​​​in PHP. Friends in need can refer to it.

Example of $_POST value transfer in php, please refer to it.

Example 1, use $_POST to pass value

<?php
$_POST['name'] = trim($_POST['name']);

if (strlen($_POST['name']) == 0) {
    $errors[] = "姓名必填!";
}

Example 2, verification required items

<?php 
if (strlen($_POST['email']) == 0) {
   $errors[] = "请输入Email地址";
}

Example 3, required fields for detection

<?php
if (! strlen($_POST['flavor'])) {
   print '请输入您喜欢的冰淇淋口味';
}
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn