You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
How to display HTML forms in a module

21.12. How to display HTML forms in a module

When you have HTML forms in a module, you may run into problems with passing the values from the form fields to the module itself. Here is just a simple form that you can use as a starting point for your own module with forms - just make a folder named Testing (for instance) in your modules folder, and put an index.php in it with the following code (see File doesn't exist error when posting with a form):

<?php
if (!eregi("modules.php", $PHP_SELF)) {
  die ("You can't access this file directly...");
}
require_once("mainfile.php");
include("header.php");
$module_name = basename(dirname(__FILE__));
echo "<center><form action=\"modules.php?name=$module_name\" method=\"post\"> "
."Name: <input type=\"text\" name=\"yourname\" size=\"20\" 
  value=\"$yourname\">&nbsp;&nbsp;"
."<input type=\"hidden\" name=\"test_input\" value=\"test is good\">"
."<input type=\"submit\" value=\"Submit\"></form></center>";
if($test_input != "") {
  echo "<br>Form worked, and yourname is $yourname";
}
include("footer.php");
?>
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 4.267 Seconds - Could not connect to database