Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/316245-i-am-stuck-on-contact-form-issue/
Share on other sites

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...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.