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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Php Help With Retrieving Info From The Server?

    I am using a flat file (txt file) to send & receive info from the server, but what i want to is, when the customer registers and sends a name or email using a form and a POST method, they will receive a message that they have been registered and to log in, but when they log in , all the data that is in the txt file shows, and i want just the name of the user to show. this is what i have at present but it isnt working right? an ideas please!!

    <html>
    <body>


    <form action="testlogin.php" method="get">
    Surname: <input type="text" name="name" />
    Sex (M/F): <input type="text" name="sex" />
    <input type="submit" />
    </form>
    </body>
    </html>

    <?php
    $file = fopen("welcome.txt", "r");
    if(!$file) {
    print "error! The file could not be opened";
    exit;
    }

    // read file and print, line by line

    while(!feof($file)):
    $text = fgets($file);
    echo $text . "
    ";
    endwhile;
    fclose($file);
    ?>

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,455
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    We need to know what your text file looks like.
    Cut and paste in a post.

  • #3
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    text file is this:

    |1 |11|21|31|41|51|71|81
    |2 |12|22|32|42|52|72|82
    |3 |13|23|33|43|53|73|83
    |4 |14|24|34|44|54|74|84
    |5 |15|25|35|45|55|75|85
    |6 |16|26|36|46|56|76|86
    |7 |17|27|37|47|57|77|87
    |8 |18|28|38|48|58|78|88
    |9 |19|29|39|49|59|79|89
    |10|20|30|40|50|60|80|90

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    This looks familiar...
    Last edited by Inigoesdr; 11-15-2007 at 06:29 PM.

  • #5
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    Maybe it's homework.

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,455
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    Which one is the name of the user?

    "Welcome 1 to my website"?

  • #7
    New to the CF scene
    Join Date
    Nov 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry that was the wrong text file, the text file i have has only one customer which i posted to the text file myself to test how to send info by using the post method

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,455
    Thanks
    8
    Thanked 1,084 Times in 1,075 Posts
    well? let's see that file then.


  •  

    Posting Permissions

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