Page 1 of 1

$_POST not working

Posted: Sun Sep 12, 2010 10:20 pm
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.

Re: $_POST not working

Posted: Sun Sep 12, 2010 10:32 pm
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.

Re: $_POST not working

Posted: Mon Sep 13, 2010 4:53 am
by tonchily
It's allright, just make sure you have a field with attribute name="price" on the page where's form located.

Re: $_POST not working

Posted: Mon Sep 13, 2010 7:58 am
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