Example of $_POST passing value in php

WBOY
Release: 2016-07-25 08:56:34
Original
1410 people have browsed it
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[] = "姓名必填!";
}
Copy after login

Example 2, verification required items

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

Example 3, required fields for detection

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!