Page 1 of 1

Extracting Post Variables

Posted: Tue Dec 19, 2006 11:27 am
by nhammond
I am working on a page that writes to a CSV and the form that it is getting the information from has about 25 fields and they are all necessary fields. So instead of doing individual variable assignments i just put them through a for loop like this...

Code: Select all

foreach($_POST as $name => $value)
		{
			$replace = str_replace(",","",$value);
			$data .= '"' . trim($replace) . '"' .  ",";
			
			
		}
The replace portion in there is just for the csv don't worry about that. My problem is when it goes through all of the variables it extracts a variable called 'x' and one called 'y'. They come with random values too x is usually between like 80-100 and y is usually between 5-30 in value. It works if i just put these as a hidden field in firefox and set their value to nothing but in IE it still writes the values in. I know it is making these variables because i printed them all out and they print out all the way at the end but these are nowhere to be found in my form. Is this a server configuration issue? It didn't do this on the development server i was using but the server it is on now puts these in. Help would be greatly appreciated! Thank you!

Posted: Tue Dec 19, 2006 11:29 am
by feyd
It sounds like you are using an image for the submit button.

Posted: Tue Dec 19, 2006 11:30 am
by nhammond
feyd wrote:It sounds like you are using an image for the submit button.
Yes I am is there a way around this? or to fix this? I would prefer to use an image for the button since it looks better

Posted: Tue Dec 19, 2006 11:31 am
by John Cartwright
you could check for it's existence, and delete them if found.

Code: Select all

if (isset($_POST['x'])) unset($_POST['x']);
if (isset($_POST['y'])) unset($_POST['y']);

Posted: Tue Dec 19, 2006 11:41 am
by nhammond
Jcart wrote:you could check for it's existence, and delete them if found.

Code: Select all

if (isset($_POST['x'])) unset($_POST['x']);
if (isset($_POST['y'])) unset($_POST['y']);
Thank you very much i didn't even think of that