Forms authentication back-end infrastructure PHP-

Forms authentication back-end infrastructure PHP-

First, what is a form?

Form in a web page is mainly responsible for data acquisition.

A form has three basic components:

Form label: It contains a method for processing form data submitted to the server using dynamic scripting and URL data.

Form field: Contains text box, password box, hidden fields, multi-line text boxes, check boxes, radio buttons, drop-down selection boxes and file upload box and so on.

Form button: comprising submit button, reset button, and general buttons; means for transmitting data to a server on the dynamic scenario or cancel input buttons may also be used to control other forms defined script processing process.

 

scenes to be used:

  • Login box
  • search bar
  • Message Box
  • Upload box
  • ...... (various boxes)

 

Second, how to create a form?

Form Tags:

  • <form action= "URL" method="GET/POST" >

Form fields: the form components, mainly

  • Text box, password box, hidden fields, check boxes, radio buttons, file upload box
  • Multi-line text box (text field)
  • Drop-down selection box
  • ……

Form button:

  • Submit button
  • reset button
  • General button

Form Tags:

<form action= "URL" method="GET/POST" >

 

 

Form fields, buttons

 

 

Third, reception and verification form

Verification form:

  • Data length
  • type of data
  • The existence of sensitive content (stripos function) stripos (what to look for, what you want to find)

 

 

isset () does not return it if the variable exists is NULL true, false otherwise

 

 

Four, PHP and database interaction

Form actually do is to submit the data to the back-end script, and then processed after the back-end script acceptance. We are here talking about PHP and mysql database interaction

 

We will use a PHP extension mysqli 

 

Connect to the database: mysqli_connect ( '127.0.0.1', 'root', 'root', '3_9') (connection address, the connection account, the connection password, connect to the database)

 

Execute database statements: mysqli_query ($ conn, $ sql) (database connection function, execute SQL statements)

 

Data obtained after executing database queries through an object, we need to convert the object array

 

From the result set fetch all rows of the array becomes mysqli_fetch_array ($ result) (obtained result set to perform a database)

 

 

Guess you like

Origin www.cnblogs.com/J-zhy/p/11263100.html