Format of sending data from HTML form via POST (code attached)

不言
Release: 2018-12-04 14:21:11
Original
4396 people have browsed it

When sending data from a POST form, it has the following format: (name of input field) = (value of input field) is in the form of & connected. Spaces and non-ASCII characters (like Chinese) are URL encoded and sent.

Format of sending data from HTML form via POST (code attached)

(name of input field 1) = (value of input field 1) & (name of input field 2) = (value of input field 2) & ...

Let’s look at the specific code

PostForm.Format of sending data from HTML form via POST (code attached)

     
Value-01
Value-02
Value-03
Value-04



Value-05

Value-06

Copy after login

Description:

with Form of HTML form tag. POST form data by setting method="post". The target URL for POST is specified by action="PostDest.aspx". If not specified, a POST will be performed to the same URL.

Server side

The server side receives the POSTed data and displays it. We use ASP.NET to build it below.

PostDest.Format of sending data from HTML form via POST (code attached)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PostDest.aspx.cs" Inherits="HtmlForm.PostDest" %>      
Copy after login

PostDest.aspx.cs

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; namespace HtmlForm { public partial class PostDest : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { StreamReader reader = new StreamReader(Request.InputStream); string str = reader.ReadToEnd(); reader.Close(); Label1.Text = str; } } }
Copy after login

Running results:The following effect will be displayed on the browser

Format of sending data from HTML form via POST (code attached)

Enter values in the text box or in each field. After inputting, click the [POST] button.

Format of sending data from HTML form via POST (code attached)

Finally, the POST data sent to the server will be displayed on the browser page.

The above is the detailed content of Format of sending data from HTML form via POST (code attached). For more information, please follow other related articles on the PHP Chinese website!

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
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!