Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2004, 10:57 PM
Authorized User
 
Join Date: Apr 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default about post and get method

hello
i am a beginner of web programming
and i dont quite understandan post and get method,
though i have refer to books. and i dont quite understand
the attribute action in form element too.
who can give me some help
thanks

 
Old August 2nd, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

POST and GET are methods of transferring form information to another page without using cookies, sessions, etc.

To use forms this way, you need a dynamic page that reads the information you're posting to, such as an ASP, PHP or CGI page.

Refer to this page with the action attribute:

<form action='form_reading_page.php'>

Using GET will take all the values of the form inputs and put them in the querystring. For instance, using this code and typing "test" in the box it creates:

<form action='form_reading_page.php' method='get'>
    <p>
        <input type='text' name='textbox'/>
        <input type='submit' value='go'/>
    </p>
</form>

...will take you to the page
http://yourdomain.com/yourdirectory(s)/form_reading_page.php?textbox=test

Using POST, the querystring is not created. So, using the same code as above, the information will be kept from visibility. This does not mean it is secure.

Getting values submitted from forms is very easy in the major server languages.

In PHP, POST values are retrieved like this:

$variable = $_POST['name_of_input'];

And GET like this:

$variable = $_GET['name_of_input'];

In ASP, POST:

Request.Form("name_of_input")

GET:

Request.QueryString("name_of_input")

When retrieving GET values, know that the user can manually add or change values just by typing the address in the page.

The method attribute is required for valid HTML, but most browsers default to GET without it.

Hope this clears things up a bit.

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
post method franta1346 Reporting Services 0 July 22nd, 2007 11:08 PM
POST method not working ganesh15 Beginning PHP 2 February 18th, 2006 08:35 AM
using post method urgently skyman763 General .NET 0 February 13th, 2005 10:43 AM
using post method urgently skyman763 General .NET 0 February 13th, 2005 10:42 AM
Post Method? zhenwe1 Servlets 0 January 25th, 2004 01:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.