Introduction
Creating a confirmation page that shows the content of a form in HTML/PHP can be a daunting task. However, with the right steps and knowledge, it can be done easily. In this article, we will discuss the steps needed to create a confirmation page that shows the content of a form in HTML/PHP. We will also discuss the best practices for creating a confirmation page and how to ensure that the page is secure. By the end of this article, you will have the knowledge and skills needed to create a confirmation page that shows the content of a form in HTML/PHP.
Solution
The following code is an example of how to create a confirmation page that shows the content of a form in HTML/PHP:
HTML:
PHP:
Confirmation Page
Name:
Email:
In case your want to try, I made something that, I hope, is what you wanted to do.
I used some JavaScript and jQuery library. (I have no idea if you are familiar with it or not. I tried to explain simply what I am doing, I recommand you to search for more informations about it and learn the basis. ? )
I assume your bootstrap template already includes jquery.js
library.
HTML
<div class="tab-content">
<!-- Tab containing the form -->
<fieldset class="tab-pane active" id="pers_tab">
<form id="my_form">
First name:<br>
<input type="text" name="firstname" id="firstname"><br>
<!-- Other fields (lastname, email, etc.) -->
<button type="submit" class="btn btn-default" id="submit_btn">Submit</button>
</form>
</fieldset>
<!-- Tab containing the confirmation infos -->
<fieldset class="tab-pane" id="conf_tab">
Please confirm your informations :<br />
Firstname: <span id="confirm_firstname"><!-- Empty span for now, but we will put the firstname here. --></span><br />
<button type="submit" class="btn btn-default" id="confirm_btn">Confirm</button>
</fieldset>
</div>
JavaScript
$(document).ready(function() {
$('#submit_btn').click(function() {
// Triggered when the element with id 'submit_btn' is clicked.
// Get the value of the field with 'firstname' id.
var firstname = $('#firstname').val();
// Put it as text in the element with 'confirm_firstname' id.
$('#confirm_firstname').text(firstname);
// Hide form tab and show confirmation tab
$('#pers_tab').removeClass('active');
$('#conf_tab').addClass('active');
// Prevent the form from submitting
return false;
});
$('#confirm_btn').click(function() {
// Submits the form with id 'my_form'
$('#my_form').submit();
});
});
1
solved How to make a confirmation page that shows content of a form in HTML/PHP? [closed]
How to Make a Confirmation Page That Shows Content of a Form in HTML/PHP?
Creating a confirmation page that shows the content of a form is a great way to ensure that the user has entered the correct information before submitting it. This can be done using HTML and PHP. Here is a step-by-step guide on how to make a confirmation page that shows the content of a form.
Step 1: Create the Form
The first step is to create the form that the user will fill out. This can be done using HTML. The form should include all the necessary fields that the user needs to fill out. Make sure to include a submit button at the end of the form.
Step 2: Create the Confirmation Page
The next step is to create the confirmation page. This page should include all the information that the user has entered in the form. This can be done using PHP. The code should look something like this:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
?>
<h1>Confirmation Page</h1>
<p>Thank you for submitting your information. Here is a summary of what you entered:</p>
<p>Name: <?php echo $name; ?></p>
<p>Email: <?php echo $email; ?></p>
<p>Message: <?php echo $message; ?></p>
The code above will display the information that the user has entered in the form. Make sure to include a submit button at the end of the confirmation page.
Step 3: Link the Form and Confirmation Page
The last step is to link the form and confirmation page. This can be done using HTML. The code should look something like this:
<form action="confirmation.php" method="post">
<input type="text" name="name">
<input type="email" name="email">
<textarea name="message"></textarea>
<input type="submit" value="Submit">
</form>
The code above will link the form to the confirmation page. Make sure to include the correct path to the confirmation page in the action attribute.
That’s it! You have now created a confirmation page that shows the content of a form. This is a great way to ensure that the user has entered the correct information before submitting it.