Page 1 of 1
only return 1 value array();
Posted: Sun Feb 18, 2007 4:15 pm
by ianhull
Hi Guys,
can anyone please tell me why this is happening?
It is only returning the last values.
Code: Select all
<?php
foreach ( $_GET as $varName => $postData )
$columnName = array("{$varName}",);
$dataValue = array("{$postData}",);
print_r(array_combine($columnName,$dataValue));
?>
Posted: Sun Feb 18, 2007 4:44 pm
by feyd
several things
- $columnName is the only line in the loop.
- your code is creating a new array each time $columnName is set, wiping out all previous information.
- I don't see the point of this code. It appears you're simply copying $_GET.
Posted: Sun Feb 18, 2007 4:49 pm
by ianhull
Thanks Feyd,
In the end I will be collecting data from a POST form and entering the data into my DB,
First of all what I'm tring to do here is retrieve all the posted data as value pairs and place them into an array for later insertion into my db.
I know that this is not very secure, but for now it is ok.
How would I get it to loop through all the posted data and place all entries into an array?
thanks
Posted: Sun Feb 18, 2007 5:04 pm
by feyd
Posted: Sun Feb 18, 2007 5:23 pm
by ianhull
Thanks Feyd, Managed to get that working fine now
One other thing,
Do you know how to get the referer domain only, not the full domain and file?
I need
http://www.domain.com not
http://www.domain.com/links.html
Thanks.
Posted: Sun Feb 18, 2007 5:24 pm
by Chris Corbyn