user application editing – form store & retrieval from DB
-
I wish to enable users to create, store, retrieve, and edit applications (as for a task to perform), where the user describes themselves, skills, etc. The site is to store the data in a DB, retrieve it, modify, submit for consideration, and repeat. Additionally there is general information about the tasks to perform, which is augmented with blogging, comments, etc (normal WordPress features).
So I have struggled to understand the best WordPress scheme for presenting a form with data retrieved (specific to each user), and accept the post to store the data back.
I have arrived at a design that seems to work without any mods to WordPress. Are there suggestions for doing this in a more natural way?I created a Page template, which uses the site Theme, and has this structure:
if ! is_user_logged_in() $message = "sorry, please login" else ? if POSTed form data, UPDATE data into DB header("Location: success-Page") exit() //else retrieve data by current_user->ID into an array //now start the Theme get_header() if $message != "" echo $message else //show the form form action="" method="post" ...fields, extracting data from array as needed get_footer()
As you can see, there are two integration points to the WordPress flow. One is there seems no target but self for form action. I would prefer being able to name a related php file as target.
Second, when finished with a DB update, I use browser redirect to get to a permalink success-Page, which I seem to have to hard code.Any suggestions?
I’ve tried to understand using a plugin, but it doesn’t seem to change the fixed integration points (form has to submit to self, and browser redirect upon success to a hardcoded permalink (which only works of course if no preceding output is produced by the Theme)).Thanks!
Rich
- The topic ‘user application editing – form store & retrieval from DB’ is closed to new replies.