2 forms submitting to one database row - php

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.

Related

Insert record into mysql with different id (by user ID)

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

can we use user input data from one form in another form of same page

I have two forms in the same page, the first form will have email, name, password etc.
In a second form there are qualification, skills, institution etc.
I will add data from the first form into one table. I want to take the ID of the data from the first form and add qualifications, skills and institution in another table along with the ID from the first form.
I am doing this in php. Please give me an idea how to implement this.
try to do it with Ajax
User enters email, pass..etc, and clicks submit button after that trigger Ajax Call with form data. Store the data in your table and return Mysql Last Inserted Id. Store Last Inserted Id in your load JS Variable/HTML Hidden value.
Steps :
- User Enters Details and press Submit button
- Ajax call triggers with your data
- get Last Insert id from back-end(ajax response)
- store id in html hidden value or js variable
- use this details for next form

How to export webform data in mysql table?

Suppose I got a webform with some fields like "Name, Surname, Address, Phone, Email, Preference, Hobby". What I need now is when a user is filling the form, Suppose he fills the Name field, the data is stored in the sql table, same goes for surname, once surname field is filled now Name and Surname will be saved in the table. The save must be done on the lost focus event of each field. The user can abandon the form filling anytime, even if the form is not completely filled.
The form by default has the status “Abandoned” which is stored in a hidden field, but once all fields in the form have been completely filled, this status should change to “Processed”.
Can anyone please suggest or get me an example of how this can be done?
You can implement this logic:
Add additional field in database for session ID
On lost focus, call ajax to update DB's field and you can check
record with session ID field.
you can also check using PHP for all fields' value to identify record
status instead of javascript update in hidden field

Html Inserting multiple row in the database at once php/mysql

I have a form with 5 textfields. I want users to fill out the form for any number of people then click next to enter an amount. Then I want to calculate the amount for the number of users filled then submit to the database. For example, when a user fills out the form for 5 people and then proceeds to fill the amount which calculates the total and splits it back to the different rows.
1.. user fills a form for more than one person. 2.. the information are been held in an array. 3.. the user proceed to the payment page , if he fills for 5 people e.g if payment for one person is $500 , the code calculate for 5 which is 500*5 = $2500 but still insert $500 each of the rows.

How to make a database fill out parts of a form?

I am looking for information on how I can use a database to fill in parts of a form.
I have a Notify Me form that will be available on two different pages. On the first page, the customer will have to fill out the entire form. (Ensuring I know what item they want to notified about.)
On another page is a database in which I will have all the items listed plus item that are not yet available. (The database entry will be seen before the item is available and the notify me form will be a marketing tool the item.)
I want to include a link to the same Notify Me form, as seen on the first page, in the database, however, I would like this form to check the database to see if the item is already entered, and if so, fill out that information in the form.
Notify Me form
Field 1: Customer Name
Field 2: Email
Field 3: Model Number of item
MySQL Database
Field 1: Type
Field 2: Model Number
Field 3: Price
Field 4: Link to form
So, as you can see the Model Number is in both the form and the database. If my customer clicks on the link for the form from within the database (Field 4), I want Field 3 of the Notify Me form to be automatically filled out with the value in Field 2 of the database with in the form opens.
Not quite sure what you're asking, but maybe this is what you need?
<?php
$modelNumber = mysql_fetch_array(mysql_query("SELECT ModelNumber FROM ? WHERE ?"));
?>
<input type="text" name="modelNum" value="<?php if ( $modelNumber != "") { echo $modelNumber; } ?>"/>

Categories