$_POST not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vfm
Forum Commoner
Posts: 32
Joined: Tue Mar 30, 2010 10:47 pm

$_POST not working

Post by vfm »

Hi,

I've got a form which submits a bunch of fields and on the following page I'm trying to use those values to update the database. However, I cannot get it to work for some reason. Here's my code:

Code: Select all

<?php
	$price=$_POST['price'];

echo $price;

?>
Do I need to set anything up to enable this $_POST feature to work?

Cheers,
Kieran.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: $_POST not working

Post by requinix »

Besides what should be fairly obvious, no there's nothing extra to do. If the page was submitted via POST and there was a "price" field then that code will work.
tonchily
Forum Commoner
Posts: 54
Joined: Thu Sep 02, 2010 10:44 am

Re: $_POST not working

Post by tonchily »

It's allright, just make sure you have a field with attribute name="price" on the page where's form located.
simonprince
Forum Newbie
Posts: 4
Joined: Thu Sep 09, 2010 7:48 am

Re: $_POST not working

Post by simonprince »

One thing I always do wrong is set the post method on the form to GET and then try and use the POST feature. And then wonder why it's not working.

Worth giving that a check.

S
Post Reply