Displaying content of a WordPress Form


<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
* {font-family: "franklin gothic book"; font-size: small;}
h2 {font-size: 150%;}
table,td,th {border-collapse: collapse; border: 1px dotted #afafff; padding: 3px 5px;}
th {background: #efefff;}
</style>
</head>
<body>


<?php


// STATE YOUR VARIABLES
////////////////////////////////////////////////////////////////////
	$user  = "annual2015";
	$pass  = "tuYPLUY44DxjRCNB";
	$db    = "annual2015";
	$table = "wp_a15_fm_data_22";
	$sql   = "SELECT * FROM $table ORDER BY `timestamp` DESC LIMIT 0, 500";


// ESTABLISH THE CONNECTION
////////////////////////////////////////////////////////////////////
	$cxn=mysqli_connect("localhost","$user","$pass","$db");
	$cxn->set_charset("utf8");
	if (mysqli_connect_errno())
	{
	echo "Failed to connect to MySQL: " . mysqli_connect_error();
	}
	$result = mysqli_query($cxn,"$sql");


// GET NUMBER OF ATTENDEES
////////////////////////////////////////////////////////////////////
	$rows = mysqli_num_rows($result);
	printf("<h2>Current number of registered attendees: <span style=\"background: #ff0; font-size: 20px;\">%d</span></h2>",$rows);


// CREATE THE TABLE
////////////////////////////////////////////////////////////////////
echo "<table>
	<tr>
	<th>First name</th>
	<th>Last name</th>
	<th>Job title</th>
	<th>Organisation</th>
	<th>Email address</th>
	<!-- <th>Food requirements</th> -->
	<th>Date registered</th>
	</tr>\n";
while($row = mysqli_fetch_array($result))
	{
	echo "	<tr>\n";
	echo "	<td>" . "<b>" . $row['text-56275de811d4e'] . "</b>" . "</td>\n";
	echo "	<td>" . "<b>" . $row['text-56275dea2cd60'] . "</b>" . "</td>\n";
	echo "	<td>" . $row['text-56275dfd39f14'] . "</td>\n";
	echo "	<td>" . $row['text-56275dfb697d7'] . "</td>\n";
	echo "	<td>" . "<a href=\"mailto:" .$row['text-56275df9b2872'] . "\">" .$row['text-56275df9b2872'] . "</a>" . "</td>\n";
//	echo "	<td>" . $row[''] . "</td>\n";
	echo "	<td>" . $row['timestamp'] . "</td>\n";
	echo "	</tr>\n";
	}
echo "</table>";


// CLOSE THE CONNECTION
////////////////////////////////////////////////////////////////////
mysqli_close($cxn);
?>
</body>
</html>


  1. No comments yet.

  1. No trackbacks yet.