have this problem.
Have small web app. There are 10 users.
Every user has own form and he must fill it every day. Inserting into mysql works fine.
Problem is every user has his own numbering. YEAR-MONTH-CUSTOM-NUMBER
User 1: 202111121, 202111122, 202111103 etc
User 2: 202111221, 202111222, 202111203 etc
user 3: 202111321, 202111322, 202111303 etc
My question: how can I define inserting records via form for users into mysql?
For example today User1 save html form so it'll insert record into mysql with id 202111121.
Today the same user will fill form again and he must insert record with id 202111122
etc.
Thank you
I have 2 forms, each one is on a different page, and they both fill information in the same table in the database. Whenever I try to fill them up, the database displays the information as 2 entries, how I can I display the information in the same row in mysqli?
(first form asks the user to submit first name and last name, second form asks him to submit email and phone number) putting them in one form is not an option.
How can I assign frontend submitted form to the backend users? Backend users are 3-4 in count and may increase any time, we have a special table and CRUD functionality to create users.
I tried the following way, but it's not working.
I created a table named auto_assign and inserted the submitted form count for each form submitted in that table, after that I took count of the backend users, now I have a count of both:
1. the total form submitted today
2. total count of backend users.
now I wanted to assign the form in following way
if we suppose that we have 5 forms and 3 backend users
form 1 must be assigned to user 1,
form 2 must be assigned to user 2,
form 3 must be assigned to user 3,
form 4 must be assigned to user 1,
form 5 must be assigned to user 2
and the form 6 whenever is submitted must be assigned to user 3 again and the flow must go on,
How can I proceed?
When you inserting form data fetch users id and calculate to whom you should assign current form. you should also fetch latest assigned form.
Pseudo code:
$myNewForm = some data
$myLatestInsertedForm = [assigned_user_id: 7]
$myUsers = [1,2,3,6,7,8] : 6
new_form_id = insert into form ();
//calculating
if (assigned_user_id < max($myUsers)) {
user_id = next(assigned_user_id, $myUsers)
} else {
user_id = min($myUsers)
}
assing (new_form_id, user_id)
I have a form where I have 11 elements, for simplicity purposes I am going to show only three on here.
1 Member Name: => Text field
2 Membership Type: => Select options field
3 Invoice ID: => Text field.
The requirement condition for this form is that the Invoice Id needs to be unique and has a post processor that checks if the Invoice Id already exists in the database. If the Invoice Id is in the database then the form submit returns an error or else it submits. Now the problem I am having with this is that sometimes the User needs to update or change the Membership type without touching the Invoice ID, in these circumstances the form needs to be submitted but the processor blocks it since the Invoice Id will already be in the database.
Note: this form submits to the members table so there is auto increment id number for each record.
So I solved this issue with this way. Since this form relates to a member table, Each Record will have a unique ID. I modified the form post processer to check for every invoice id in the table but the current ID. This way I can make sure the form will be saved every time while having a unique invoice id for each record.
I have a very basic form consisting of only two dropdown boxes (though the contents of the second dropdown vary depending on the selection made in the first). I then have a bit of text that displays under the second dropdown box once a selection has been made, and what the text says is unique to whatever selection is made.
What I want to be able to do is have this information directly publish into a table that will be included at the bottom of the same page the form is located on, once a user hits the submit button. In other words, when a user submits the form, I don't want it to simply spit the user's info back to them; I want the info to actually publish to the page in a table, so that anyone who logs in can see it, and can add their own published info to the table as well.
You could think of it sort of like a blog commenting system that automatically publishes new content to the page every time a visitor submits the form, except, instead of text areas that allow users to insert whatever they want, I have dropdown boxes that only allow them to select a certain option, and then have that selected info publish to a table.
How would I go about doing this? I have a beginner's knowledge of PHP, and almost no knowledge of javascript. But depending on how detailed and helpful of an answer that may be provided, I could work with either.
This form is only accessible to members who are logged in, and I have 6 bits of info that I want to have published into a row of 6 columns in the table every time a user hits Submit. Those 6 things are: (1) Username, (2) Time Stamp (Date & Time at which the form was submitted), (3) Selection result of 1st Dropdown, (4) Selection result of 2nd Dropdown, (5) The unique text that is displayed according to whichever selection is made in the 2nd dropdown, and (6) a second time stamp which is calculated as 30 days beyond the time generated in the 2nd column.
Any help would be appreciated. I'm experimenting with PHP a bit but my knowledge is really not advanced enough yet to really allow me to progress much of anywhere on my own.
EDIT:
I did some playing around earlier and have made a few changes. First, I'm now wanting 1 dropdown box, not 2. Second, there are 9 columns in the table, not 6. Third, I have a database with the following 4 tables:
table: members
member_id
firstname
lastname
login
passwd
rank_id
table: ranks
id
name
table: jobs
id
name
requirement_1
requirement_2
requirement_3
salary
rank_id
table: workorders
date
username
rank
job
requirement_1
requirement_2
requirement_3
salary
due_date
Here is the current site I am working on: http://www.kiithsoban.com/membership
You may use a guest login to gain access:
Username: username
Password: password
This is a personal project made for an online gaming clan (in EVE Online), with all of maybe 20 unique visitors a month, so quality and proper coding technique is not much of an issue (not at this point anyway). The primary concern is simply that it will work.
The reason I suggested posting a PHP table rather than taking the javascript route is because I already have a table created in a database (and I'm also more familiar with PHP and just want to get the first version of this online ASAP), and I already have it posting to the website as well, as you'll see on the above page. This is the "workorders" table.
You'll notice upon logging in that there are instructions on the index page referring to a dropdown box, which does not yet exist. The dropdown box will consist of 49 "jobs" to select from. When a user selects an option and submits the form, I want their selection to insert into the "job" field of the workorders table on my database; and, I also want the site to detect the additional information in the other 8 fields in order to automatically insert them as well.
I've been experimenting with one idea, but I'm not sure if it would work, or how to do it exactly. In my members and jobs tables, I've included a "rank_id" field, in which each entry will have a matching value to the "id" field in the ranks table. Now, there are 49 "jobs" to choose from, however, depending on what rank a user is, their job salary will vary (given that there are 7 ranks, 49 * 7 = 343 total possible job/salary combinations that can result from the form submission). What I want the site to do is detect the logged in user's "rank_id" (in the members table), and after the user selects a job from the drop down, find the corresponding job in the jobs table that has the same "rank_id". That, I'm assuming, would allow the site to gather the "User", "Rank", "1st Requirement", "2nd Requirement", "3rd Requirement", and "Salary" info (all of which are contained in the members and jobs tables), and then insert that info into the appropriate fields in the workorders table, so that the info will then post to the site.
At that point all I would need to worry about are the "Date" and "Due By" columns - the "date" being automatically generated as the current date when the form is submitted, and the "due by" being automatically calculated as the current date plus 30 days.
I hope that's a more helpful explanation, and not too confusing.
You will need to create an OnSubmit event for the form which will return false inside the javascript function. The function will then need to add the content to the page. I would give more detailed code if you provided a layout.