I am a bit at lost as my PHP knowledge is very basic to say the least, but I am learning on the fly.
In a Wordpress plugin, I have the following php function:
$pool->get_leagues( true );
which gives a an array of league values: the id number and the name of the league.
Then there is this function:
$pool = new Football_Pool_Pool;
$pool->update_league_for_user( get_current_user_id(), <<THIS IS WHERE SELECTED ID NUMBER GOES>> );
I need to create an HTML form that lists the available league names that the user on a page can select in either an dropdown form, with radio buttons or plain links, whatever is easiest for the example.
Then, when the user makes a choice and submits the values, the league value should be updated into the database as per the above function.
Here are my total newbe / dummy questions:
- How does the PHP look that would create the desired action? where would I put this code? Do I create a whole new PHP page to handle this form, or do I need to enter it into one of the existing php pages somewhere?
- Based on answer 1, how does the HTML look that would display the form and call the php once submitted?
- If this is easier with javascript, please feel free to share that example.
Help is much much appreciated!