Organisation of Data Forms

Web Forms are pages that your users request through their browser and that form the user interface (UI) that give your web applications their look and feel. These pages are written using a combination of HTML, server controls, and server code. When users request a page, it is compiled and executed on the server, and then it generates the HTML markup that the browser can render. Forms are enclosed in the HTML form tag. This tag specifies the communication endpoint the data entered into the form should be submitted to, and the method of submitting the data, GET or POST.

Some of the interpreted languages commonly used to design interactive forms in web development are PHP, Python, Ruby, Perl, JSP and some of the compiled languages commonly used are Java and C# with ASP.NET.

PHP is one very common language used for server-side languages and is one of the few languages created specifically for web programming.

To use PHP with an HTML form, the URL of the PHP script is specified in the action attribute of the form tag. The target PHP file then accesses the data passed by the form through PHP's $_POST or $_GET variables, depending on the value of the method attribute used in the form. Here is a basic form handler PHP script that will post the form's contents, in this case "user", to the page using GET:

Form.html

< html >< body >

< form action="form_handler.php" method="GET">

User Name: < input name="user" type="text" />

< input type="submit" /></ form >

</ body ></ html >

Form_handler.php

<html><body>

<?php

$name = $_GET['user'];

echo "Hello, ". $name."!";

?>

</body></html>


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: