I have a MySQL database with the following fields:
ID (speaks for itself), _sfm_form_submision_time_ (time form was submitted), _sfm_visitor_ip_ (visitor IP address), Name (Visitor's Name), Town (visitor's loacation), Emaiil (visitor's Email), Message (Text block to leave a message up to 500 chars).
(And I now see I made an error in a field name, by using Emaiil instead of Email).
However, I would like to display the submitted data, only for the fields Name, town and message in a table on my website.
I have a bit of code, but then get hopelessly stuck.
I would like the display to look something like the attached screenshot.
I already have a bit of code, but then I get hopelessly stuck.
This is what I have:
<?php
$username="mrdee";
$password="**********";
$database="mrdee_reloader";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
mysql_query($query);
mysql_close();
$query="SELECT * FROM rouw";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
while ($i < $num) {
$Name=mysql_result($result,$i,"Name");
$Town=mysql_result($result,$i,"Town");
$Emaiil=mysql_result($result,$i,"Emaiil");
$i++;
};
?>
(Not sure whether that is all 100% correct).But then, I get hopelessly stuck with the code to put those data in a table as in the screenshot below.
Anyone who could help, please?
Also, I have tha page with the form to enter the data, and I would like the display table to appear below the form.
The code for that page is as follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en"> <head> <meta charset="utf-8"> <meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)"> <meta name="created" content="Wed, 09 Feb 2011 09:55:46 GMT"> <meta name="description" content=""> <meta name="keywords" content=""> <title></title> <!--[if IE]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <div align="center"><h1>Betuig Uw deelneming - Express your sympathy</h1> De dood van een jonge, moedige vrouw kan niemand onberoerd laten.<br> <br />Daarom heb ik, na het insturen van een bericht door een bezoeker, besloten hier een rouwregister te plaatsen.<br> Dit zal, bij voldoende invoer, overgemaakt worden aan de nabestaanden van <i>Marie-Rose Morel</i>.<br> Alle velden zijn verplicht, Uw e-postadres, echter, dient enkel om U een bevestiging te sturen, en wordt noch getoond, noch ergens anders voor gebruikt.<br> Alvast hartelijk bedankt.<br> De webmeester.<br /><br /> The death of a young, brave woman cannot leave anyone untouched.<br> <br />That is why I, after a visitor sent a message of sympathy, have decided to put a condoleance register here.<br> I will, if there is enough input, pass it on to <i>Marie-Rose Morel</i>'s loved ones.<br> All fields are required, your e-mail address, however, is only needed to send you a confirmation, it will not be shown, nor used for anything else.<br> Thank you very much in advance.<br> The webmaster.<br /><br /> <iframe src='http://www.vlaanderen-flanders.org.uk/forms/rouw/rouw.php?sfm_from_iframe=1' frameborder='1' width='45%' height='640' allowtransparency='true'></iframe></div> <br /><br /> </div> </body> </html> </body> </html>
The "<iframe></iframe>" is the link to display the form, should I now, when I have the full code for formatting the table, use another iframe below it, or should I just put the PHP code below it, or should the code for the display table be written in HTML?
Sorry if my questions seem somewhat stupid and/or if my coding is lousy, but I am a COMPLETE novice when it comes to PHP, and I would desperately love to learn more..
Any help will be much appreciated.
PS. In the mean time I have corrected the field name error from 'Emaiil' to the correct 'Email'.
condtable.jpg 36.53K
6 downloads
Edited by moderator, 30 April 2012 - 12:00 PM.
programming language used should be in code tags















