1. [ANNOUNCEMENT] Hello Guest, Buying Target|BestBuy|Ebay|Google|GoBank|Itunes|Apple|Walmart| good rate CLICK HERE!

Inserting information into the database

Discussion in 'Programming, Scripting & Coding Discussion' started by beingchinmay, Jun 28, 2016.

  1. beingchinmay

    beingchinmay ECZ Member

    Jan 1, 2016
    Likes Received:
    There’s a basic rundown of HTML forms in Appendix A. Check that if you need to. For now we will just point out that every form element has a name, and when a form is submitted the names of those form elements become available as variables in the PHP script the form was submitted to. With the following form, as soon as the form is submitted, the variables $surname and $submit will become available in the PHP script myscript.php. The value of $surname will be whatever the user enters into the text field. The value of $submit will be the text string “submit.â€

    Before we show the script itself, now is a good time to note that Web program-ming is slightly different from other types of programming in one important respect: It is stateless. To display a page, a Web server must first receive a request from a browser. The language they speak is called HTTP, the Hypertext Transfer Protocol. The request will include several things — the page the browser wishes to see, the form data, the type of browser being used, and the IP address the browser is using. Based on this information, the Web server will decide what to serve.

    Once it has served this page, the server maintains no connection to the browser.It has absolutely no memory of what it served to whom. Each HTTP request is dealt with individually with no regard to what came before it. For this reason, in Web programming you need to come up with some way of maintaining state. That is, if you are progressing through an application, you will need some way of letting the server know what happened. Essentially, you will need ways of passing variables from page to page. This will come up in our applications. The applications will
    solve this problem in one of three ways: by passing hidden form elements, by using cookies, or by using sessions .

    Now back to our script

    You can decide what you will display on a page based on the variable informa-tion that comes from HTML forms. For instance, you could check if the preceding form had been submitted by checking if the variable name $submit had a value of “submit.†This very technique will come into play when it comes to creating the page for inserting information into the database.

    Fat Cutter