jasonc Posted July 15, 2010 Share Posted July 15, 2010 I wish to add another layer to my existing array at present i have the forms field name/id, i.e. 'fieldid1' and the text that is shown beside the text field 'User name' $formarray= array('fieldid1'=>'User name', 'fieldid2'=>'Name'); what i wish to add is a new layer to this array to include the database field name which will be a shorter name than that which is shown to the viewer filling out the form I wish to have say... 'fieldid1' as the fieldid, 'hdyfu' as the database field name, 'How did you find us' would be the text beside the text field to be filled out. can someone guide me on how i do this please. redoing the whole site so the database and the form fields are the same is not an option as their are way to many forms to redo so adding in a new layer seems the only and best way that this can be done. Quote Link to comment https://forums.phpfreaks.com/topic/207885-need-array-for-form-data-using-forms-name-fieldid-and-db-table-name/ Share on other sites More sharing options...
DavidAM Posted July 15, 2010 Share Posted July 15, 2010 Something like this? $formarray= array('fieldid1'=> array('Caption'=>'User name', 'DBfield'=> 'hdyfu'), 'fieldid2'=>array('Caption'=>'Name', 'DBfield'=>'col2')); Quote Link to comment https://forums.phpfreaks.com/topic/207885-need-array-for-form-data-using-forms-name-fieldid-and-db-table-name/#findComment-1086742 Share on other sites More sharing options...
jasonc Posted July 15, 2010 Author Share Posted July 15, 2010 not sure. something like this $array['fieldid1'][1] = "Username"; // field id name $array['fieldid1'][2] = "Please enter your username:"; // text thats shown beside the field $array['fieldid1'][3] = "name"; // database field name $array['fieldid2'][1] = "Email"; // field id name $array['fieldid2'][2] = "Please enter your email address:"; // text thats shown beside the field $array['fieldid2'][3] = "email"; // database field name and so on Quote Link to comment https://forums.phpfreaks.com/topic/207885-need-array-for-form-data-using-forms-name-fieldid-and-db-table-name/#findComment-1086763 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.