Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

2olive on "Select a post by post title, then select corrisponding post meta, then update"

$
0
0

Hi all. A lot of problems in this plugin I'm trying to develop.
A bit of information first.
The plugin is about swimming competitions. I've created two custom post types: swimmers and competitions. Let's focus on competitions because for swimmers is the same thing (actually in my mind).
The name of the competition is the title of the CPT. Competition has got 2 post meta: the date and the pool length.
I've also created a custom table in the database to report the timings each athlete has in each competition.
For the custom table I followed this tutorial
And here are the issues:
1) replace the input box for the competition with a select box, so the user can select among the competitions already inserted
2) once the competition has been selected, update two readonly input boxes with its corresponding post metas
3) hoping to save all this
In pastebin the two versions of the plugin (relevant parts only):
a) the first version of the admin table (it works!!!)
b) the second version of the admin table :(((((

In this last attempt my problems are
- storing the competition selected in the select box (aka the CPT post title) because I'm always getting the last one inserted
- I can't access this post title with $_POST[$item[name]]
- I can't retrieve the post metas

If I change the variables literally with the name of the competition, I can get the post meta but I'm not able to update the infos in the table (JavaScript needed but I can't take it anymore)

I hope I have explained myself. Any help would be greatly appreciated.

PS There are typos in the code due to copy and paste. Sorry for that.


Viewing all articles
Browse latest Browse all 8245

Trending Articles