Hello there in a trouble please help me I want to display all the inserted data from the user in the form of a table ie. For example if a user has just visited to my website for first time and after fulfilling all the details for the signin page and for registration page he must be redirect to another page and should displayed all the inserted data by him in the form of a table to him.
What have you tried so far? What is the trouble you are going through exactly?
Scenario flow:
- User fills in form and submits the data to your script
- You validate the data (and prevent SQL injection using prepared statements) in the script and save it to database
- Redirect user to the page where you want to show him the data he just filled in
- Fetch the data for the user from database and print it out on the page (remember to sanitize for XSS)
You must use javascript and php. For example
function inputField(){
var input1=document.getElementById('here write the id of the input tag').value;
if(input1==null){
alert('Fill the blanks');
}
};
and then after all the input filelds are completed the use
header("Location:file directory that you want to send the user.php );
If you have write some code it will help us.
There is no need to use javascript.
Validation via javascript cannot be relied upon for security. It can be used as an optional extra, but proper secure validation must be done server-side.
I use javascript only for empty or not validation not to cross check data with the database.
Hy Liontas as you helped me i am still getting some more doubts in the code
here is the code of mine as i have specified in my website
How Should i declare the name of thr ID.
You should still validate (check for empty value) on the server side in the first place before processing the data. Whether the processing involves database or not. As @SamA74 pointed out with JS you can do client side validation but it can not be trusted.
As i understand your question you can set your own id inside HTML tag eg
<input id="what ever you like" >
Yes but amitkanjiyani3398 says that this must doing at the first time that the user is going to register. He didn’t say that this user is already member so that at this case I have data for crosschecking.
Hy liontas I am making a website for the pouropose related to job Suppose You Are the first time visitor of my website and you will be asking for descripton of your job so after describing your post you will be redirecting where you can see your post and so that any of the another person searching for particular job post will be able to see your post as you have describe
For example if You are a person hiring employees related to android gaming and i am the person searching for the job related to android gaming so how come we both will be redirected to a single page where i can see them post you have describe for the android gaming
plzz help me i trouble!
The most basic way to do this would be to just echo
the form data via $_GET
/ $_POST
, like e.g.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Form</title>
</head>
<body>
<form action="action.php" method="POST">
<input type="text" name="firstname">
<input type="text" name="lastname">
<input type="submit" value="Submit">
</form>
</body>
</html>
action.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Data</title>
</head>
<body>
<table>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
</thead>
<tbody>
<tr>
<td><?= $_POST['firstname'] ?></td>
<td><?= $_POST['lastname'] ?></td>
</tr>
</tbody>
</table>
</body>
</html>
Of course, as already stated a register process would also include some database operations; and once it’s in the database, you can access it from anywhere (not just the form action). Also note that the above example is really just for demonstration purposes; normally you’d use some sort of template engine to generate dynamic pages, so as not to mix markup and logic.
It was the great idea Liontas thankss for the suggestion but i m facing some more problem plz help me for example you are searchig for a job for suppose related to Gaming pourpose so i have kept 3 option name as (1)Category(2)Sub-category and the third named as Salary so suppose if you are selecting an option named as Gaming in category options in the dropdown you should be automaticall redirected to the subcartegories related to the gaming for example as PC Gaming,Android Gaming and after selecting the subcategory you should be able to select amount of the salaries related to gaming please suggest me as fast as possible. here is the picture of the dropdowns
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.