forsakenmemory Posted July 21, 2007 Share Posted July 21, 2007 i just want to be able to build a script that outputs the submitted information onto the same page it came from! how do i do this please. [<?php // retrieve form data $age = $_POST['age']; // check entered value and branch if ($age >= 21) { echo 'Come on in, we have alcohol and music awaiting you!'; } if ($age < 21) { echo "You're too young for this club, come back when you're a little older"; } ?> /code] how would i get the echos to appear on the same page insted of going to a new page? thanks Quote Link to comment Share on other sites More sharing options...
redarrow Posted July 21, 2007 Share Posted July 21, 2007 <?php echo $_SERVER['PHP_SELF'];?> in the form Quote Link to comment Share on other sites More sharing options...
ss32 Posted July 21, 2007 Share Posted July 21, 2007 do what he said... and you will also have to create something that lets the page know that the form has been submitted. <?php if (isset($_POST['age'])) { $age = $_POST['age']; }else{ $age = -1; } if ($age > -1) { ?> <!-- display age stuff --> <?php }else{ ?> <!-- display form --> <?php } ?> Quote Link to comment Share on other sites More sharing options...
forsakenmemory Posted July 21, 2007 Author Share Posted July 21, 2007 <?php echo $_SERVER['PHP_SELF'];?> in the form this is not what im asking!!!! this allows you to access the php on the same page not to disply the output on the same page! 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.