pet22 Posted May 2, 2023 Share Posted May 2, 2023 Hello friends, I am working on a personal project using php and mysql. I have created a basic simple login system where user can register for an account and login. I have added CRUD functionality to it so user can add and remove information. Below is the part that I am struggling with. What I am looking to do is that I want to use a contact form but for each user is registered they can generate embed code of that contact form and put it on their website. So whoever fills out that form the data will be stored in the database and the user can login to see that data. Can someone point me in the right direction on how I can achieve this task specifically embed code and each user can only see their embed form data when they check when the login into their profile. Quote Link to comment https://forums.phpfreaks.com/topic/316245-i-am-stuck-on-contact-form-issue/ Share on other sites More sharing options...
requinix Posted May 2, 2023 Share Posted May 2, 2023 Keep in mind that the URL you give people to embed in a site will be visible to every single person on the internet who cares... Basically, you make a form like normal, but you take a parameter from the URL to identify which user to associate the form with, and you pass that parameter along when submitting the data. So it looks something like Embed this in your website! <iframe src="https://www.example.com/path/to/embeddable/form.php?user=123456789" other attributes...></iframe> Your form.php takes the user value, validates it's good, and if so copies it into the form, either as a URL parameter <form action="/path/to/submission/script.php?user=<?= $userId ?>" method="post"> or as a hidden input <input type="hidden" name="user" value="<?= $userId ?>"> When the user submits the form, you have the data as well as the owning ID. Disclaimer: that's all quick and easy but in exchange it's rife with opportunities for abuse... Quote Link to comment https://forums.phpfreaks.com/topic/316245-i-am-stuck-on-contact-form-issue/#findComment-1607962 Share on other sites More sharing options...
pet22 Posted May 3, 2023 Author Share Posted May 3, 2023 I will give this a try and if any further issues I will let you know but thank you for the explanation. Quote Link to comment https://forums.phpfreaks.com/topic/316245-i-am-stuck-on-contact-form-issue/#findComment-1607971 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.