Lil background:
I have a form that is stored in mysql... each of the fields a user can fill are by default filled like this:
[name]
so if theres an input box called "Employee" by default in the db it's value is [employee], now, based on the query string my form will ereg those out if ?mode=new and then they are just blank lines that the user can work with...
ok, now for my question
i need to process this form and a bunch other by submitting the form back to itself using ?mode=process... when this happens I get the $_POST array which is keyed to each of those form "element" values... since there are to be lots of forms I cant hard code any of the eregs by a particular "element name"... sow hat i need todo is this:
take the post array, search the form for each key(which is in the same [name] format) and when it finds that, replace it with that keys value
example:
Array
(
[to] => John Smith
[employee] => Brian Ellwood
[fax] => 123-456-7890
[pages] => 10
[phone] => 098-765-4321
[longdate] => April 27, 2006
[re] => Testing
[cc] => N/A
[comment] => on
[message] => Sample Message
)
is a $_POST dump after I array_pop the submit button value out... now im left with just the form values
so, as u can see each key is formatted EXACTLY how the default form values are... just need to ereg_replace for each array key and its value
hope ive provided enough info... any help its greatly appreciated!
and just for simplicity, the string that I'm working with is:
$data = $row['data'];
THANKS!