[solved]-Need Figure File Work Q39004532
need to figure out why this file does not work
<?php
// Confirmation page setup
//Create connection
$firstname = $_POST[‘firstname’];
$lastname = $_POST[‘lastname’];
$telephone = $_POST[‘telephone’];
$con = mysql_connect(“localhost”, “test2”, “123”,”CIT647StudentsConcertsProfiles”); //’mysql.default_host’,’mysql_user’, ‘mysql_password’
//check connection
if (!$con) {
die (“Connection failed: ” . mysql_error());
}
echo “Connected successfully test2.”;
// selected database
mysql_select_db(“CIT647StudentsConcertsProfiles” . $con);
//Create Random Unique ID for RowNum field in DatabaseTable
$pattern =”1234567890″;
$rownum = $pattern{rand (0,10)};
for ($i = 1; $i < 10; $i++)
{
$rownum = $pattern{rand(0,10)};
}
// sql to create test table
$sql = “INSERT INTO CIT647StudentsConcertProfilesTable (rownum,firstname, lastname, telephone)
VALUES ($rownum, ‘$_POST[firstname]’, ‘$_POST[lastname]’,$_POST[telephone])”;
//store from names in variables
$firstname = $_POST[‘firstname’];
$lastname = $_POST[‘lastname’];
$telephone = $_POST[‘telephone’];
if (myql_query($sql . $con)) {
echo “Records added successfully test2.”;
} else {
echo “ERROR: Not able to execute $sql. ” . mysql_error($con);
}
//close the connection
mysql_close($con);
?>
<html>
<head>
<meta charset=”utf-8″ />
<meta name=”viewport” content=”width=device-width,initial-scale=1″ />
<!–[if lte IE 8]><scriptsrc=”assets/js/ie/html5shiv.js”></script><![endif]–>
<link rel=”stylesheet” href=”assets/css/main.css” />
<!–[if lte IE 9]><link rel=”stylesheet”href=”assets/css/ie9.css” /><![endif]–>
<!–[if lte IE 8]><link rel=”stylesheet”href=”assets/css/ie8.css” /><![endif]–>
</head>
<body>
<center><img src=”images/Pic01Main.jpg”alt=”SNHU-a-Palooza The Concert” /></center>
<!– create confirmation page –>
<br><center><h1>We’ve received yourinformation</h1></center>
<br>
<center>Thank you for submitting your information for theconcert.<br>
Make sure to print a copy of the following information for yourrecords.<br>
a ticket for you when you arrive at the ticketbooth.<br>
<br>
Your ticket confirmation number is as follows:<br>
<br>
<?php
echo “Confirmation Number: ” . $rownum . “<br>”;
echo “First Name: ” . $firstname . “<br>”;
echo “Last Name: ” . $lastname . “<br>”;
echo “Telephone Number: ” . $telephone . “<br>”;
?>
<br>
<input type=”button”
onClick=”window.print()”
value = “Print This Page” />
<br> <a href=index.html>Return to thehomepage</a></center>
</body>
</html>
Expert Answer
Answer to need to figure out why this file does not work … . . .
OR

