php - How to create duplicate form from multi dimensional $_POST array -


the form have in theme multi part form , submitting following post data

 array ( [action] => save [packageid] => 0 [form] => array     (         [post_title] => title         [post_content] => description         [category] => 30,35,7     )  [custom] => array     (         [post_tags] => keyword, key, keys         [phone_number] => 577xxxxxx         [price] => 400         [map_location] =>          [map-log] =>          [map-lat] =>          [map-country] =>          [map-address1] =>          [map-address2] =>          [map-address3] =>          [map-zip] =>          [map-state] =>          [map-city] =>      )  [check_multi] => 1 ) 1  

i want create second form dynamically, using foreach loop , hidden fields name of hidden field match $_post[key] , value of hidden field value of $_post[value]

the original form has name set example

name="custom[map-log]" 

would right in thinking can form keys example

name="form[post_title]" 

points note, values change, wont know if keys same can't make duplicate form , populate post data need created , populated automatically.

thanks in advance.

ok huge +1 jay blanchard direction. it's not getting help, helps it's knowing how gets there. right working. i've never seen format in form name before it's handy. here solution.

<?php foreach($_post $key => $value){     if(is_array ($value)){       foreach($value $subkey => $subvalue){   ?>          <input type="text" name="<?php echo $key; ?>[<?php echo $subkey; ?>]" value="<?php echo $subvalue; ?>" /><br />       <?php  }    } else {   ?>          <input type="text" name="<?php echo $key; ?>" value="<?php echo $value; ?>" /><br />     <?php  } } 

and understand why works lot more having not been spoon fed answer looking in tiredness last night.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -