Hi Guys
I have been asked to make an online sign up sheet system by my boss. I have almost finished but have encountered a problem. To sign up to the created activity I have use a previous form to add a "page name" which is then used to generate a new html page. I now want to write to this new page with important info, such as Event name, dates, etc. I came up with a method so far to do this, as messy as it may be. However halfway through (line 88) it stops writing properly and just prints out the php code as text. I have only just learned php so that I can do this project so am not particulary good at it. Many thanks and sorry for the essay.
<html>
<head>
</head>
<body>
<?php
ob_start();
header("location: sign_up.php");
$sitename = $_POST[eName];
$title = $_POST[eName];
$sDate = $_POST[sDate];
$enDate = $_POST[enDate];
$exDate = $_POST[exDate];
$desc = $_POST[desc];
$pName = $_POST[eName];
$con=mysqli_connect("localhost","emuas","flgdls","EMUAS_signUp");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="INSERT INTO TEST (EventName, StartDate, EndDate, ExpiryDate, PageName, Description)
VALUES
('$_POST[eName]','$_POST[sDate]','$_POST[enDate]','$_POST[exDate]','$_POST[eName]','$_POST[desc]')";
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
$fileStart='<html>
<head>
<title>';
$fileStTable=' </title>
</head>
<body>
<table>
<tr align="left">
<th> ';
$fileSDate=' </th>
</tr>
<tr align="left">
<th> Start Date: ';
$fileEnDate='</th>
<th> End Date: ';
$fileExDate='</th>
<th> Expiry Date: ';
$fileDesc='</th>
</tr>
</table>
<table id =createSheet>
<tr align="left">
<th> Description: ';
$fileEnTable='</th>
</tr>
</table>
';
$filePHP='
<?php
$con=mysqli_connect("localhost","emuas","flgdls","EMUAS_signUp");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sign = mysqli_query($con,"SELECT * FROM SIGN_UP_TEST ORDER BY User");
echo "<table>
<tr>
<th>Name</th>
<th>Status</th>
<th>Comments</th>
</tr>"; // Error occurs on this line by writing the "; and everythign after as text
while($row = mysqli_fetch_array($sign))
{
echo "<tr>";
echo "<td>" . $row["User"] . "</td>";
echo "<td>" Attending "</td>";
echo "<td>" . $row["Comments"] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>';
$fileForm='
<form action="sign_user.php">
<table>
<tr>
<td> Name: <br /> <input type="text" name="User" /> <input type="submit" value="Sign Up"/> </td>
</tr>
<tr>
<td> comments: <br /> <input type="text" name="comments" /></td>
</tr>
</table>
</form>';
$fileEnd=' </body>
</html>';
$fp = fopen("sign_up_sheets/$sitename.html", "w");
fputs($fp, $fileStart);
fputs($fp, $title);
fputs($fp, $fileStTable);
fputs($fp, $sitename);
fputs($fp, $fileSDate);
fputs($fp, $sDate);
fputs($fp, $fileEnDate);
fputs($fp, $enDate);
fputs($fp, $fileExDate);
fputs($fp, $exDate);
fputs($fp, $fileDesc);
fputs($fp, $desc);
fputs($fp, $fileEnTable);
fputs($fp, $filePHP);
fputs($fp, $fileForm);
fputs($fp, $fileEnd);
fclose($fp);
mysqli_close($con);
?>
<script>
window.alert("Your event has been created")
</script>
ob_end_flush();
</body>
</html>