Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Form and Results on same page, along with a echo.

    Okay... I am trying to make a simple php page. All I want it to do, is for the user to enter his/ her name, and a php script echos the name out to the same page. The form would be submitted, then the form would switch places (disappear) and the echo would print the name. It would be nice to see the name appear on every page I place the code on. It would also be even better if the page prompts the user for their name, then it appears on every page I place the code on.

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    The first part of your problem is shockingly similar to the example in the introductory tutorial found at php.net.

    http://us3.php.net/manual/en/tutorial.forms.php

    Retaining information from page to page is a bit more involved so you should proabably tackle the basics first.

  • #3
    New to the CF scene
    Join Date
    Feb 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation So?

    So how to I do I do it then?

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Surely you clicked on that link I gave you.

  • #5
    New Coder
    Join Date
    Dec 2010
    Posts
    62
    Thanks
    2
    Thanked 0 Times in 0 Posts
    maybe like this
    PHP Code:
    <?php


    if(!empty($_POST['name'])){
    echo 
    $_POST['name'];}else{echo"<form method='post' action=''>name:<input type='text' name='name'><input type='submit' name='submit' value='submit'></form>";}
    ?>
    i


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •