This has been driving me nuts for the past 2 days. Any help will be greatly appreciated.
here it is:
I would like to fetch the field names using mysql_fetch_field from my table, called 'listing', while looping every $_POST from my form, then insert it in my database.
e.g.
foreach($_POST as $fieldname => $values) {
echo $fieldname.'-'.$values.'<br />';
}
yields:
Title_Details - data from form
Location - data from form
Address - data from form
Property Type - data from form
...and so on
The problem is, the name of my fields in my table are different. For instance 'Title_Details' is 'titledetails'. Therefore I would like to fetch the field names from my table using mysql_fetch_field.
e.g.
while ($fields = mysql_fetch_field($query)){
echo $fields->name.'<br />';
}
yields:
titledetails
location
address
propertyType
Ultimately, I want to combine the two together and end up with:
titledetails - data from form
location - data from form
address - data from form
propertyType - data from form
Thanks for your help... Please let me know if I have to be more clear.