tags:

views:

226

answers:

10
+3  Q: 

$_GET and $_POST

Hi ,

Really silly question but having a off day today.

basically I have a form and the method is set to post on the action page when I use $_POST i dont get the value but if I use $_GET or $_REQUEST I do. this does not make sense could some on just clarify it for me.

the code of the form is

<form action="create.php" method"POST">

just realised I am missing the = after method.

Thanks guys.

Monday morning

+1  A: 

What's the method set to in the HTML for your form, eg:

<form method="POST" ...>
MalphasWats
`basically I have a form and the method is set to post` - Don't post questions as answers, that's what comments are for.
Andy E
should be in comments, not answers
Josef Sábl
heh, and my 'answer' was so far off the mark. Punished for being so quick :)
MalphasWats
+9  A: 

It sounds like you've misplaced or mistyped the method attribute and your form is defaulting to HTTP GET. The form should look like this:

<form method="post" action="file.html">
Johannes Gorset
Nice - you guessed the problem without seeing any code!
Dominic Rodger
In the code posted you were missing an equals sign after the 'method'. Glad you solved it
Alex Mcp
+1  A: 

In PHP ini file, the default setting GPC (Get, Post, Cookie) and Request array has that in itself. And make sure that you really the the POST in the action attribute.

Sarfraz
+1  A: 

It looks like you typoed your HTML:

<form action="create.php" method"POST">

should be

<form action="create.php" method="POST">

You're missing an equal sign.

Tom Ritter
A: 

Your method attribute is wrong, should be:

<form action="create.php" method="POST">
Alix Axel
+1  A: 
<form action="create.php" method="POST">

your missing equal sign after the method

Michal M
A: 

Hehe :-)

<form action="create.php" method="POST">

Your sloppy way of writing is not good for coding...

Josef Sábl
A: 

POST and GET are different methods to transfer form data, they both use different ways to send the entered values to your application and have to be handled differently. PHP uses $_POST for the values submitted by a form with method="post" and $_GET for values submitted by a form without a method or with method="get". $_REQUEST is a combination of $_POST and $_GET.

The easiest to see difference is:
Parameters submitted with GET appear in the adress bar, i.e.
http://example.com/index.php?page=home

passes the key page with the value home to $_GET.
Post parameters do not appear in the adress bar.

dbemerlin
A: 

The error seems to be the missing "=" :) BTW, the $_REQUEST variable isn't just a combination of $_POST and $_GET, it's an associative array that by default contains the contents of $_GET, $_POST and $_COOKIE. ;)

feragusper
A: 

This isn't your job is it??! (I hope not)

pondpad