Jump to content

[SOLVED] displaying output in display area


forsakenmemory

Recommended Posts

the following is an example code only. i want to display the echo output commands into an iframe or equivilant within the page itself and not on a new page as the default does.

 

if im using the incorrect terminology please forgive me. but i cant think of a better way to explain it and so far no one seems to have the slightest clue what i mean at all.

 

 

<html>
<head>
<title>Web Design Digital - Term & Conditions</title>

<link rel="STYLESHEET" href="main.css" type="text/css">
</head>
<body>

<?php
/* if the "submit" variable does not exist, the form has not been submitted - display initial page */
if (!isset($_POST['submit'])) {
?>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    Enter your age: <input name="age" size="2">
    <input type="submit" name="submit" value="Go">
    </form>


I would like the output to appear around here somewhere. doesnt matter how, i know its possible. ive seen it done i just dont know the code.

<?php
    }
else {

    $age = $_POST['age'];
    if ($age = 21) {
        echo 'Come on in, we have alcohol and music awaiting you!';
        }
    else {
        echo "You're too young for this club, come back when you're a little older";
    }
}
?>

</body>
</html>

 

thank you if someone can please answer this question.

Link to comment
https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/
Share on other sites

<html>
<head>
<title>Web Design Digital - Term & Conditions</title>

<link rel="STYLESHEET" href="main.css" type="text/css">
</head>
<body>

<?php
/* if the "submit" variable does not exist, the form has not been submitted - display initial page */
if (!isset($_POST['submit'])) {
?>

    <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
    Enter your age: <input name="age" size="2">
    <input type="submit" name="submit" value="Go">
    </form>
<?php }
?>
I would like the output to appear around here somewhere. doesnt matter how, i know its possible. ive seen it done i just dont know the code.
<br />
<?php
    

    $age = $_POST['age'];
    if ($age = 21) {
        echo 'Come on in, we have alcohol and music awaiting you!';
        }
    else {
        echo "You're too young for this club, come back when you're a little older";
    }

?>

</body>
</html>

wow. Don't know why people try to help anyway. I think, though that you are a little confused because the page looks different after submitting the form. You could take out the if! isset part at the beginning and then your form will show no matter what.

 

<html>
<head>
<title>Web Design Digital - Term & Conditions</title>

<link rel="STYLESHEET" href="main.css" type="text/css">
</head>
<body>


    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    Enter your age: <input name="age" size="2">
    <input type="submit" name="submit" value="Go">
    </form>


I would like the output to appear around here somewhere. doesnt matter how, i know its possible. ive seen it done i just dont know the code.

<?php

if (isset($_POST['age'])){

    $age = $_POST['age'];
    if ($age >= 21) {
        echo 'Come on in, we have alcohol and music awaiting you!';
        }
    else {
        echo "You're too young for this club, come back when you're a little older";
   
      }
}
?>

</body>
</html>

 

was missing the double >= that makes it work too. didn't notice that before.

im sorry for barking but this is like the 10th time ive posted the same question and gotten really noob like almost to the point of being insulting answers!

 

 

i give up!! thank you for your help but you just wasted like 2 days of my time (not you personally but this entire forum) and caused me unbelieveable amounts of stress i think i might go and hang myself now! bye!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.