The problem is when you submit a length and girth I get the same page. How can I make this work? Here is the code that I am using.
Code
?php
if (!defined("LOADED_AS_MODULE")) {
die ("You can't access this file directly...");
}
global $pnconfig;
$pntable = pnDBGetTables();
$ModName = basename( dirname( __file__ ) );
//End PNphpBB2 Module
define('IN_PHPBB', true);
// Begin PNphpBB2 Module
$phpbb_root_path = './modules/PNphpBB2/';
//End PNphpBB2 Module
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_SEARCH);
init_userprefs($userdata);
include ("header.php");
if (empty($girth)) {
print "This page is still under construction";
print "<br><br><br>";
print "<h4>Want to know the weight of a lunker bass you caught, but left your scale at home?</h4>";
print "<h5>Well you are in luck...If you remembered to measure the length and girth!</h5>";
print <<<HERE
<br>
<br>
<form>
Enter the length:
<input type = "text"
name = "length"><br>
Enter the girth:
<input type = "text"
name = "girth">
<br>
<input type = "submit">
</form>
HERE;
} else {
$weight = ($length*($girth*$girth))/927;
print "<br><br><br>";
print "Your Bass weighed approximately $weight lbs";
} //end
// include footer junk
include("footer.php");
?>
if (!defined("LOADED_AS_MODULE")) {
die ("You can't access this file directly...");
}
global $pnconfig;
$pntable = pnDBGetTables();
$ModName = basename( dirname( __file__ ) );
//End PNphpBB2 Module
define('IN_PHPBB', true);
// Begin PNphpBB2 Module
$phpbb_root_path = './modules/PNphpBB2/';
//End PNphpBB2 Module
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
// Start session management
$userdata = session_pagestart($user_ip, PAGE_SEARCH);
init_userprefs($userdata);
include ("header.php");
if (empty($girth)) {
print "This page is still under construction";
print "<br><br><br>";
print "<h4>Want to know the weight of a lunker bass you caught, but left your scale at home?</h4>";
print "<h5>Well you are in luck...If you remembered to measure the length and girth!</h5>";
print <<<HERE
<br>
<br>
<form>
Enter the length:
<input type = "text"
name = "length"><br>
Enter the girth:
<input type = "text"
name = "girth">
<br>
<input type = "submit">
</form>
HERE;
} else {
$weight = ($length*($girth*$girth))/927;
print "<br><br><br>";
print "Your Bass weighed approximately $weight lbs";
} //end
// include footer junk
include("footer.php");
?>
Oh, also I would like to truncate the weight at 2 decimal places. I am very new to PHP and have not learned how to do this yet.
Thanks for the help
James
www.e-bassangler.com
