Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Dispensing text from a text file

Dispensing text from a text file

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
questionphphtmldatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    John Smith 2
    wrote on last edited by
    #1

    In my php file called "account.php" I have

      <?php
    
        // First we execute our common code to connection to the database and start the session
        require("common.php");
    
        // At the top of the page we check to see whether the user is logged in or not
        if(empty($\_SESSION\['user'\]))
        {
            // If they are not, we redirect them to the login page.
            header("Location: login.php");
    
            // Remember that this die statement is absolutely critical.  Without it,
            // people can view your members-only content without logging in.
            die("Redirecting to login.php");
        }
    
    ?>
    <html>
    <body>
    <link rel="icon" type="image/gif" href="favicon.gif" />
    <?php include("header.php"); ?>
    <div id="main-box">
    <ul>
    <li class="buttons">
    <?php
    TEXT BOX WITH A LINE FROM \*\*TEXT.txt\*\* SHOULD APPEAR HERE AFTER USER CLICKS BUTTONS
    <input type="button" name="account" value="Get Your Account" onclick="#" />
    </li>
    </ul>
    </div>
    </body>
    </html>
    

    I want it so when the user clicks the button, a text box appears and displays ONE line from the text file and when they view it, it deletes it from the text file. text.txt

    Eddie 
    Apples
    Hello
    People
    

    So after the user clicks the button it displays "Eddie" line to them and then deletes it after the user sees it so that the next line "Apples" would then become the first line. If you don't understand my question then please let me know and I will try to explain further. Thank you. :)

    Z 1 Reply Last reply
    0
    • J John Smith 2

      In my php file called "account.php" I have

        <?php
      
          // First we execute our common code to connection to the database and start the session
          require("common.php");
      
          // At the top of the page we check to see whether the user is logged in or not
          if(empty($\_SESSION\['user'\]))
          {
              // If they are not, we redirect them to the login page.
              header("Location: login.php");
      
              // Remember that this die statement is absolutely critical.  Without it,
              // people can view your members-only content without logging in.
              die("Redirecting to login.php");
          }
      
      ?>
      <html>
      <body>
      <link rel="icon" type="image/gif" href="favicon.gif" />
      <?php include("header.php"); ?>
      <div id="main-box">
      <ul>
      <li class="buttons">
      <?php
      TEXT BOX WITH A LINE FROM \*\*TEXT.txt\*\* SHOULD APPEAR HERE AFTER USER CLICKS BUTTONS
      <input type="button" name="account" value="Get Your Account" onclick="#" />
      </li>
      </ul>
      </div>
      </body>
      </html>
      

      I want it so when the user clicks the button, a text box appears and displays ONE line from the text file and when they view it, it deletes it from the text file. text.txt

      Eddie 
      Apples
      Hello
      People
      

      So after the user clicks the button it displays "Eddie" line to them and then deletes it after the user sees it so that the next line "Apples" would then become the first line. If you don't understand my question then please let me know and I will try to explain further. Thank you. :)

      Z Offline
      Z Offline
      Zamshed Farhan
      wrote on last edited by
      #2

      Not so clear!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups