about wood with BiggerflyThis is the first PHP series of wood
BiggerflyIt's just a translation.
forced to fly ~ up, because it's PHP, so here's the
Hump namingJust like the meaning of the name, this series teaches you how to use PHP to fly
of course, there are some that I used to think that forcing lattice to fly, but the result of the eggThe wood-wood brain hole
PHP yii framework of form validation rules Daquan, YII framework
Yii is a high-performance, component-based PHP framework for developing large Web applications. Yii is written in strict OOP, with well-established library references and comprehensive tutorials.
Not much nonsense to say, directly to everyone put the code.
Complete Example:
Public $password 2;//fi
In PHP programming, after data is queried through a form, how can the data be displayed? For example, the form1 form has the ID, age, and sex fields, which correspond to an INPUT text box, enter the ID value, click the query button, and the action is submitted to the PHP processing page (mysql
very bad choice to prevent repeated data submission.
The Code is as follows:
The Code is as follows:
Session_start ();If (empty ($ _ SESSION ['IP']) // The first write operation to determine whether the ip address is recorded and whether to write data to the database{$ _ SESSION ['IP'] = $ _ SERVER ['remote _ ADDR ']; // writes data for the first time, paving the way for Refresh or rollback judgment.Mysql_query ("insert into admin (id, name, age) VAL
This article mainly introduces the CI framework AR operation to insert Multiple SQL data records, and analyzes the CI framework using arrays to insert multiple data records in the form of a simple example, for more information about how to insert Multiple SQL data records, see the example in this article. We will share this with you for your reference. The details are as follows:
If you do not use AR, you can do this:
Insert into table (FIELDS)
This form of automatic completion function, such as Baidu, Google, Taobao their search function are available, when the user input a content to be based on the condition display related content.
PHP code
Class datafetch{Private $conn, $rs;function __construct () {$this->conn = mysql tutorial _connect ("localhost", "root", "pwd") or Die ("cant ' t connect host~"); mysql_select_db ("Studentinfo",
Tags: PHP sql single quotesFirst look at the problem."INSERT into Tg_article (Tg_username,Tg_type,Tg_title,Tg_content,Tg_date)VALUES (' {$_clean[' username '} ',' {$_clean[' type '} ',' {$_clean[' title '} ',' {$_clean[' content '} ',Now ())"People will find that the party to submit the content and the single quotation mark, value is inside the single quotation mark, this is a clear error, this is also in the development of Web site often encountered
correctly. Htmlspecialchars, the HTML tag is converted. Extra:The role of the MAGIC_QUOTES_GPC function in PHP is to determine the data that resolves user prompts, such as the following: Post, get, and cookie data to increase the escape character "\" to ensure that the data does not cause the program, In particular, database statements have fatal errors due to pollution caused by special characters.In the
I have a search function on the home page for questions about the PHP search function and form submission. I need to query the database based on the name and time and then display it on the home page. ask how to do this, I want the search results to appear on this Homepage. I know that the form can be submitted, but I
I have a search function on the home page for questions about the PHP search function and form submission. I need to query the database based on the name and time and then display it on the home page. ask how to do this, I hope the search results will appear on this Homepage. I know that the form can be submitted, but
pagejsVerify the verification,jsThere are also many functions that verify different characters, depending on the situation
Program layer verification. Mainly considerSQLOf course.PHPFor many character processing functions, use different functions as needed.
Provides a small method to prevent SQL injection.
/*** Description filter escape POST | GET */final public static function isEscape ($ val, $ isboor = false) {if (! Get_magic_quotes_gpc () {$ val = addslashes ($ val);} if ($ isboor) {$ val
PHP Code submit.php
The problem of this code, as long as the Refresh submit.php this page will continue to add blank data to the database, ask (I am small white too senior currently do not understand) how to increase the field validation or add verification code function
Reply to discussion (solution)
$query =mysql_query ("INSERT into say (Name,tel,ask,des,time,url) VALUES (' $name ', ' $te
Because recently learning PHP, has been writing C #, today to compare the C # and PHP form submission, also as their own learning PHP recordsC # submits data in post (I'll just write the data in the background,Home page public void Home (string start) { if (this. Ispost) { string name=this. post["username"];
In this record, can not fall in the same place in the future!
The database is a BBS, the table is test. Three fields, respectively, Id,name,sex. The ID is auto_increment.
The PHP file that connects the database conn.php content is
Copy CodeThe code is as follows:
$conn = @ mysql_connect ("localhost", "root", "") or Die ("Dat
Repeated submission is a common problem during development. In addition to using js to prevent repeated submission of forms, php can also be used to prevent repeated submission.
Example 1
The Code is as follows:
Copy code
/** How to prevent repeated forms from being submitted in php*/Session_start ();If (empty ($ _ SESSION ['IP']) {// The first write operation to determine whether th
This article mainly introduces the create Method for smart Writing of ThinkPHP form data, and analyzes in detail the related techniques that can only be written to create in ThinkPHP in the form of instances, which has some reference value, for more information about how to intelligently write ThinkPHP form data to the create method, see the example in this artic
This article introduces the implementation of the PHP multi-step Fill poll form, roughly to get the user to fill in the content after the save in a hidden, and then the last step to submit to the database.
1.php
The code is as follows
Copy Code
2.
Copy CodeThe code is as follows:
Class Formmodel extends Model {
Automatic Validation settings
/*
* One: Automatic verification
The definition of automatic validation is this: Array (field,rule,message,condition,type,when,params)
Field: Represents the domain name of the database;
Rule: The representative is the rules;
Its value depends on the type;
If condition is function (callback), rule is a function name
Condition is In,rule is an array
Message:
When I was working on a company project recently, found a strange problem, submit a normal form, unexpectedly found that can not get the value of the submission, this discovery, unavoidably let me start confused, at the beginning of time I think that my service is problematic, not normal to write to the database, and then detect the SQL statement found, The original problem actually appeared in the acquisit
In development, we should be careful to prevent SQL injection, so the value of the form submitted to do the corresponding processing, you can update the data into the database
PHP annihilation function. Any value can be passed over to the conversion
Copy Code code as follows:
function quotes ($content)
{
If Magic_quotes_gpc=off, then start processin
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.