Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 29th, 2004, 10:57 PM
Authorized User
 
Join Date: Apr 2004
Location: xiamen, fujian, China.
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

Reply With Quote
  #2 (permalink)  
Old August 2nd, 2004, 01:13 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
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

<><
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 02:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.