Jump to content
itgranny

single entry based on another

Recommended Posts

I have 2 tables. One with site names and usernames, the other with data that needs to be entered from a form. The form has a dropdown list of the site names for the user to fill out. What I would like is for the form to automatically get the username and place it in the data table also, automatically.

 

 

 

ID     siteName   userName
 

1       Site 1        site1

2       Site 2        site2

3       Site3         site3

 

  1. Form has dropdown is populated with siteName from the site table.
  2. User picks one (along with other data but that's working).
  3. Submit
  4. Posted to insert page
  5. Insert page sees the siteName
  6. I want it to go to into site table and look for whatever site they chose and figure out what the userName it
  7. insert it into the username place in the data table that the form is updating.

How would I go about doing this? I've tried a bunch of different ways but keep getting errors.

Share this post


Link to post
Share on other sites

your form should submit the id and you should store the id in the second table to relate the row in the second table back to the source information in the first table. information like the sitename/username should only exist once, in the source table where it is defined/stored.

Share this post


Link to post
Share on other sites

What I would like is for the form to automatically get the username ...

 

... and figure out what the userName it

Are you invoking magic or do you have a more mundane method of storing and acquiring the username?

Share this post


Link to post
Share on other sites

So is it Ajax that you get the username right away from the form or are you saying I need to put an addional dropdown that they have to fill out?

Share this post


Link to post
Share on other sites

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.