Hello, For this assignment I'm tasked with having a user input data into a registration form.(registration.html) Once they hit submit, a confirmation page will download (print view) with the user's...

1 answer below »
Hello,
For this assignment I'm tasked with having a user input data into a registration form.(registration.html) Once they hit submit, a confirmation page will download (print view) with the user's information and a unique registitrant ID letting them know they've registered successfully.
Everytime I hit submit for the form, it downloads as a php file with none of the details being requested.I will attachthe source codes for each page. They should all work in unison. Please let me know if you can get this back to me ASAP.
I need two primary PHP functions created following the prompt attached,


IT 647 Milestone Five Confirmation Page Tutorial Part Two This is the second tutorial for Milestone Five. In our first tutorial, we covered how to establish a connection between MySQL and PHP using the mysql_connect function. In this tutorial, we will focus on PHP functions for creating a random unique concert ID for users to gain entry to the concert, how to write user form-field data to the MySQL database table, and how to set up the confirmation page with data from the user form fields, including the new concert ID they need to print out and bring with them to the concert to receive a ticket for entry. With the credentials working, you then select which database has your database table that you want to connect into through MySQL. This is done with a mysql_select_db command set to the database schema where your tables are stored. It is usually a good idea to see what database schemas are available in your MySQL data warehouse first; do this by going into SQL with Sudo MySQL, then stating SHOW databases; You will likely want to see which database tables are in your database. This is done with Select database; Then show tables; You can even view what is in your table by giving a SQL query like select * from table. This gives you a good idea of what the data structure is for your database table—for instance, if columns are integers, alphanumerics, strings, dates, dollar amounts, percentages, or other, and the header names. Typically when working with clients in the real world, you will initially ask for a data dictionary and data definitions before you engage in a project, which helps provide you with initial orientation and a clearer understanding of what type of data you will be working with. For this project, you will write two primary PHP functions. The first will create a random unique ID for your RowNum field in the database table. Your second function will insert your users’ form-field data into the database table, within your database schema, stored in your data warehouse in MYSQL. Then, your confirmation HTML displayed back to the end-user in the form of a generic web template will be scripted within the PHP file, after the PHP closure tag of ?> Your first function is a for each loop. This loop uses an integers pattern and then applies that defined pattern to select a value from 0 to 10 randomized. We want up to 10 numbers, so we set our for each loop to 10 so it increments 10 times then stops, and we place all these incremented values into the variable called $RowID. We will then write the data stored in $RowID to the database table along with the user’s submitted first name, last name, and phone number. This is done with an SQL query, but instead of writing the query on the server through a terminal window command line interface (CLI), or even the MySQL Workbench platform, we will instead write the query in PHP, stored within a variable called $sql. The query is INSERT INTO [table] (table header names) values (the values of each form field by defined variable name set to $_POST. Then we can close the mysql connection with mysql_close($con); then close out the PHP script with ?> --- Remember, the PHP script opened with section. Yes, you can have multiple PHP scripts and HTML mixed throughout the code. Finally, we include the ability for users to print the page from a button. This is done with an input type=button” set with a JavaScript onclick event of window.print(). That completes this tutorial on working with PHP and MySQL to manage your registration-form data and confirmation page with concert-entry ID. File name #1: Registration.html SNHU-a-Palooza: Registration function isEmail(ev) { //alert(ev); var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;; if (ev.search(emailRegEx) == -1) return false; else return true; } function validateForm() { //alert("Validating Form Data"); var eDate = document.getElementById("EventDate"); if(eDate.value == null || eDate.value == "") { alert("You must select an event date."); eDate.focus(); return false; } var fname = document.getElementById("FirstName"); if(fname.value == null || fname.value == "") { alert("You must enter the first name."); fname.focus(); return false; } var lname = document.getElementById("LastName"); if(lname.value == null || lname.value == "") { alert("You must enter the last name."); lname.focus(); return false; } var phnum = document.getElementById("PhoneNum"); if(phnum.value == null || phnum.value == "" || isNaN(phnum.value) || phnum.value.length != 10) { alert("You must enter the 10 digit phone number (digits only, no special characters)."); phnum.focus(); return false; } var email = document.getElementById("Email"); if(email.value == null || email.value == "" || !isEmail(email.value)) { alert("You must enter a valid email address."); email.focus(); return false; } return true; }




Registration

























Registration



Contact





Register Now!


Complete the form below and press the submit button.





  • Event Date:



  • First Name:



  • Last Name:



  • Phone #:



  • Email:














File name #2: RegForm.php

Thank you for submitting your registration. Below is your confirmation information. Please retain this information and bring a printed copy for entry at the concert.


Your ticket confirmation information:




Return to Homepage
File name #3: Confirmation.php SNHU-a-Palooza: Confirmation
Answered Same DayJul 05, 2021

Answer To: Hello, For this assignment I'm tasked with having a user input data into a registration...

Anurag answered on Jul 06 2021
159 Votes
cit647studentsconcertsprofiles.sql
-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Jul 06, 2021 at 04:48 AM
-- Server version: 5.7.23
-- PHP Version: 7.1.28
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESU
LTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `cit647studentsconcertsprofiles`
--
-- --------------------------------------------------------
--
-- Table structure for table `cit647studentsconcertprofilestable`
--
CREATE TABLE `cit647studentsconcertprofilestable` (
`RowNum` varchar(250) NOT NULL,
`FirstName` varchar(250) NOT NULL,
`LastName` varchar(250) NOT NULL,
`PhoneNum` varchar(250) NOT NULL,
`Email` varchar(250) NOT NULL,
`EventDate` varchar(250) NOT NULL,
`CreatedOn` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cit647studentsconcertprofilestable`
--
ALTER TABLE `cit647studentsconcertprofilestable`
ADD PRIMARY KEY (`RowNum`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Confirmation.php


        
Home

        
About/Details

        
Get Started

         Video Links

        
Contact Us

        
Register Now




home
|
about
|
registration
|
contact
|
For Further Support Email: Anurag Sinha
Confirmation_original.php
Registration
        Home
        About
        Contact
        
        
        
Search
        
Menu
        
Home
Go to the home page.
        
About
Get details about the concert series.
        
Contact
Reach out to us for additonal info.
Confirmation
home
|
about
|
registration
|
contact
Index.html



        
Home
        
About/Details
        
Get Started
         Video Links
        
Contact Us
        
Register Now



"Mind Over Matter is The Key to Everlasting Peace- Maya J"
Welcome to Meditation Central




Hello! Let's Walk This Journey Together!
Welcome to Meditation Central! The ultimate guide to navigating through your spiritual journey.

We train you with the best methods to mediate at home, in the office, or on the go! Wether live or pre-recorded you can watch or re-watch videos from our instructors to help you find inner peace.

Please review our website and have fun!


home
|
about
|
registration
|
contact
|
For Further Support Email: Anurag Sinha
RegForm.php
// create connection
$con = mysqli_connect('localhost','root','123456');
// check connection
if (!$con) {
die("Connection failed: " . mysqli_error($con));
}
//echo "Connected successfully.";
// select database
mysqli_select_db($con,"CIT647StudentsConcertsProfiles");
// create random unique ID for RowNum field
$pattern = "1234567890";
$RowID = $pattern{rand(0,10)};
for($i = 1; $i < 10; $i++)
{
$RowID .= $pattern{rand(0,10)};
}
// store form name in variables
$FirstName = $_POST["FirstName"];
$LastName = $_POST["LastName"];
$PhoneNum = $_POST["PhoneNum"];
$Email = $_POST["Email"];
$EventDate = $_POST["EventDate"];
// sql to create test table
$sql = "INSERT INTO CIT647StudentsConcertProfilesTable (RowNum, FirstName, LastName, PhoneNum,Email,EventDate) VALUES ('$RowID', '$FirstName', '$LastName', '$PhoneNum','$Email','$EventDate')";
if (mysqli_query($con,$sql)) {
//echo "Record add successfully.";
?>