A simple form to take user details but I want that if a user is already registered and if he enters his NAME then that script should search it in database and show his details in the form fields before submitting the form.
If I'm understanding you correctly you want a form where the user starts typing in his username and it will display the rest of his information automatically if his username exists in the database? Well in order to retrieve information from a database on the fly while a user is typing in the information (without refreshing the page) you will have to use Ajax.
But logically why would you want a form to search a database just based on a name and display the rest of that username's information before they have logged in or submitted the form? I think you should retrieve a user's details ONLY after you have verified who they are. Not just by them typing in a name. Maybe I am misunderstanding your question though.
Related
anyone here knows how to make a save and continue? I have a multi page form and it have many different parts so I need a save and continue form so they can fill out this form on the other day.
So firstly a user will log in into his/her account and they will see this link,
see image here
Once they will click on it, they will see a multi page form like this,
form image
When the user has filled out these data,
Sample data,
sample data 1
sample data 2
So when the user click save, the data that the user have input will be save so when they will log in back into his/her account the data that has been saved will be displayed in the form.
Saved data,
saved data 1
saved data 2
I have not yet tried any code because I'm new to php and mysql so please help! Thank you so much.
Each time a user selects Next, add the data provided by the user to the relevant row in a database table. In this row, have a status column with status 'Draft' until the user completes the form upon which you change the status to 'Completed'.
Each time a user opens the form, load any data already entered in the past by this user.
You might consider using a column to store information about the latest page of the form used by the user, so the user can resume at that particular page of the form later.
We are not here to provide you with all the code. If you have a problem or question related to a part of the code, feel free to ask though.
Good luck!
When the user clicks on the Next Button, Save the Data into your Mysql DB in a Save Block.
In the Save block user "INSERT" Query to Insert Data to DB.
After that use PHP "header" function to redirect to the same page.
I have a problem to make a web application where I could input a data of a customer, where user level-1 could input data and then user level-2 could check the data, and then user level-3 could approve the data and save it to database. So in every page I want to keep login with different username and password. So every level user would have their own username and password. And how can I make the application where the data that has been inputted by user level-1 in computer-1 to go to user level-2 in computer-2 for checking without saving the data to database and to user level-3 for approval in computer-3 where they would save the data ?
I'm using php and mysql. Could someone maybe give me a help? please.
you could have a second database for unapproved/unchecked data but that would not be the ideal way to do it, you would be better to do as u_mulder suggested and save to the database and have a separate column in the database table to show the status of the data
I've made a very simple form which one user input field and a submit button. My question is how do I get what the user has entered into the field onto the actual web page? For example if the user enters their name into the text field and hits enter, how would I get that text to show up on the web page and stay there so when the next person visits the name will show up and the next person can do the same?
To store user input for use later, you should look in to implementing a database. For some examples to get you started, check out the php documentation for mysql. The doc page for mysql_query has some basic examples to get you started:
http://www.php.net/manual/en/function.mysql-query.php
I was asked by a person to create a php code, which is a part of a larger ERP software development project, so that he can test my skills. The code regarding a simple user authentication once the user registers through a form , by putting name, date of birth ,email.(which I have already done through html).
The action property of the html form, is a php file which consists of php code to get the posted inputs in the form, generate a verification link, and send it to the user via his/her email which he/she has already given.
I have two basic questions or problems:
How can this verification link be created?
Once the user clicks on this type of a link how does PHP know that they did so?
I don't think that there is any concept of event-driven programming in PHP. In that case, how does PHP handle that click and give a "conformational success message"? Is a MySQL database required or is there another easier way?
When you create the user, you are also going to generate a random string for that user. This is their authorization code. You will store it with the user's data in your database.
Then you are going to make your authorize page (ex., authorize.php). It will take a $_GET parameter of 'code', or whatever else you want (ex., authorize.php?code=theHashYouCreated). This page's code will look something like this:
if(!empty($_GET['code']))
{
/*
* Get the data from the database by the provided code.
* If a result is returned, then remove the authorization
* code from the user's record. If no user is found, then
* return an error.
*/
}
else
{
//No code was provided, so we should error.
}
Now, when the user tries to login you also want to check to see if their authorization code is set in the database. If it is, then they have not validated their e-mail address yet. If it isn't, then they have validated it.
Here's a nice tutorial that should help you create a confirmation email:
http://www.learnphponline.com/scripts/email-activation-for-php-forms
It involves creating a randomly generated activation key, that will initially be stored in the database. The key should be emailed to the user in the form of a GET parameter in a link.
Once the link is clicked, the submitted GET parameter is checked with the value in the database.
my questions are about login, and changing already saved data.
Question 1
Until now I've only saved input in the tables of the database (registration steps), now I need to check if the input (login steps), match what is in database. In fact I have 3 types of users, then I'll have to check 3 kind of tables. Then if the input data matches with one of those 3 tables I will redirect the user to their specific area.
I'm thinking about saving the submitted data $login=$_REQUEST['login']; and $password=$_REQUEST['password']; and compare with the login column in the database. Then if the login matches, I'll compare the password submitted with the one in the row, not in the column. But I don't know how to do this search and comparison, neither what to use. Then if both matches I'll redirect the user. Else I'll send a login error message; I know how to do this already.
Question 2
What if I need to change an already saved user, for example if they change their email address? My changing user's data web page is exactly the same like the registration user web page. Can I load the already saved options and values of registration? Then the user will change whatever is necessary, and then when they submit the new information, they would not create a new row in my table, but just overwrite the old information? How can I do this?
Check this out.
Then if that doesn't help a bit, take a look at this.