forsakenmemory Posted July 22, 2007 Share Posted July 22, 2007 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 More sharing options...
simon551 Posted July 22, 2007 Share Posted July 22, 2007 <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> Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304390 Share on other sites More sharing options...
forsakenmemory Posted July 22, 2007 Author Share Posted July 22, 2007 omg are you people serious? Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304410 Share on other sites More sharing options...
forsakenmemory Posted July 22, 2007 Author Share Posted July 22, 2007 why is this difficult to understand? i want a box like this to appear if there is an error!! not on a new page but on the same page as the contact form informing the user of the errors they have made!!! Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304415 Share on other sites More sharing options...
simon551 Posted July 22, 2007 Share Posted July 22, 2007 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. Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304418 Share on other sites More sharing options...
forsakenmemory Posted July 22, 2007 Author Share Posted July 22, 2007 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!! Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304419 Share on other sites More sharing options...
forsakenmemory Posted July 22, 2007 Author Share Posted July 22, 2007 wow that was so simple! method="get" insted of method="post" it really was all i was asking. problem solved Link to comment https://forums.phpfreaks.com/topic/61165-solved-displaying-output-in-display-area/#findComment-304473 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.