Jump to content

The best way of displaying the webpage of an external URL as part of a PHP file


tantan

Recommended Posts

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>

--------------------------------------

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.