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; }
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 HomepageFile name #3: Confirmation.php SNHU-a-Palooza: Confirmation