Listing table contents
Now we are going to create a button to list all the content in our table.
<?php if (isset($_POST['listall'])){ if (isset($_POST['submit'])){ <?php |
There are 2 changes here. One is a new button named listall that, when pressed will list all rows in our table. The other is an IF condition to check if the listall button was pressed.
There is one more thing to do, that is replace the text with language constants so let's take care of that. Open file main.php found in folder /language/english and add this code:
| <?php define('TT_NAME','Name'); define('TT_EMAIL','Email'); define('TT_ADDRESS','Address'); define('TT_TELEPHONE','Telephone'); ?> |
Here is the final code for index.php:
| <?php // Tutorial // Created by KaotiK require('../../mainfile.php'); require(XOOPS_ROOT_PATH.'/header.php'); if (isset($_POST['listall'])){ if (isset($_POST['submit'])){ <?php |
That completes this tutorial. I hope you found it usefull.
| Here is the completed module. Check this with your own code to see if they match. |
|
Part 2 - Learn how to use smarty templates