mirah Posted March 10, 2008 Share Posted March 10, 2008 Hi I'm really new to php, please bear with me on this simple question... I'd like to print the variable in the textbox on the same page - underneath the form. Thanks in advanced. Right now the code is in the body section of an html page: <body> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="get"> Student: <input type="text" name="name"> <input type="submit" name="submit"> </form> <? echo $_GET['username']; ?> </body> Link to comment https://forums.phpfreaks.com/topic/95338-print-on-the-same-page/ Share on other sites More sharing options...
l0ve2hat3 Posted March 10, 2008 Share Posted March 10, 2008 I believe your looking for this: <body> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="get"> Student: <input type="text" name="name"> <input type="submit" name="submit"> </form> <input type='text' value='<? echo $_GET['name']; ?>'> </body> Link to comment https://forums.phpfreaks.com/topic/95338-print-on-the-same-page/#findComment-488307 Share on other sites More sharing options...
mirah Posted March 10, 2008 Author Share Posted March 10, 2008 Thanks but it didn't work There were some texts inside the text box: <? echo $_GET[ And after the text box there was this text: ' > And is there anyway to do it without a textbox...? Thanks again! Link to comment https://forums.phpfreaks.com/topic/95338-print-on-the-same-page/#findComment-488311 Share on other sites More sharing options...
l0ve2hat3 Posted March 10, 2008 Share Posted March 10, 2008 ok do this: (THIS IS TESTED AND WORKS) <form method='post'> Student:<input type='text' name='username'> <br> <input type='submit' value='submit'> </form> <br> <?php echo $_REQUEST['username']; ?> Link to comment https://forums.phpfreaks.com/topic/95338-print-on-the-same-page/#findComment-488313 Share on other sites More sharing options...
mirah Posted March 19, 2008 Author Share Posted March 19, 2008 Thank youuu!! Link to comment https://forums.phpfreaks.com/topic/95338-print-on-the-same-page/#findComment-495770 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.