tantan Posted March 6, 2007 Share Posted March 6, 2007 Hi All, Need help in order to complete the following: Through the file form.htm the users are asked to insert their weight and height which will be submitted to the result.php file using the post method. If the value for the weight ($wt) is between (70 - 85 Kg) AND that for the height ($ht) is between (170-180 cm) the result.php file will print the following comment($comment) "Your weight is within normal limits" and opens the web page of an external website ($externalURL). But if the value of $wt is between (95-110 Kg) AND that of $ht is between (160-170 cm) another comment is printed "You are over weight" and the web page of another external website is opened. My question is: What is the BEST way to make the result.php file give the previously described results through dividing the screen into 2 sections an upper 20% section showing in it the $comment variable, and a lower 80% section which should display the web page of the external url represented by the $externalURL variable. ------------------------------------ the code for the form file : ------------------------------------ <html> <head> <title>Insert your weight and height</title> </head> <body> <form action="result.php" method="post"> Your weight: <input type="text" name="weight" /> Your height: <input type="text" name="height" /> <input type="submit" /> <p> </p> </form> </body> </html> -------------------------------------------------- the code for file result.php : -------------------------------------------------- <html> <head> <title>Result</title> </head> <body> <?php $wt=$_POST["weight"]; $ht=$_POST["height"]; ?> <?php if (($wt>=70 && $wt<85) && ($ht>=170 && $ht<180)) { $comment="Your weight is within normal limits"; $externalURL="http://www.yahoo.com";} if ( ($wt>=95 && $wt<110) && ($ht>=160 && $ht<170)) { $comment="You are over weight"; $externalURL="http://www.google.com";} ?> </body> </html> -------------------------------------- Quote Link to comment Share on other sites More sharing options...
simcoweb Posted March 6, 2007 Share Posted March 6, 2007 If i'm understanding, you want the page to be split for displaying the results? Like in a frameset? Or, you could have the output written to two different tables. One at the top of the page and one below it. Quote Link to comment Share on other sites More sharing options...
tantan Posted March 6, 2007 Author Share Posted March 6, 2007 Either like a frameset or having the output written to two different tables. Both ways are accepted; depending on which one will give a better outcome. However, the later solution (two different tables) is prefered. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.