There is a similar question, it is 7 years old and not very helpful for my situation. Didn't want to frustrate anyone into thinking I didn't search. Everything else I've searched for has dealt with forms, which isn't what I need. I have the C# background and am not very familiar with PHP, so bear with me.
I have a forum hosted by another service, this service has their own database and such for storing users. This service doesn't support a function I'm trying to incorporate so I'm attempting to host my own database and do it myself.
Here's the current situation:
- Forum database holds user information, such as UserIDs, to which are unique to the users. I want my database to correspond.
- I need to send the logged in user's ID to my database, without putting in a form and asking them to give me their user ID.
- I have access to the variable that holds their ID, and just need to know how to pass it over. I can't change the forum to a.PHP and just send it from the main page.
My biggest problem:
- Most of the information I've found is outdated/depreciated.
I know JS/AJAX can be used for this, but I haven't seen any examples other than for form and I have no idea how to change it to just sending the already populated variable to my PHP file that will upload it to my database.
var id= '<!--|id|-->'; window.location.href = "myphpfile.php?id=" + id;
This is as close as I've gotten, it does what I want, but it takes my users away from the forum in order to submit this. Is there a way of passing it to the file without needing to redirect the page? Any help is appreciated, especially if you can explain to me how it works/why it works.