Need help with PHP script (very easy for programmers)

 

Results 1 to 3 of 3
Hello, I need to make a page like this one: http://mnemotechnics.org/3.1415926/t/words3.php But I need to ...
  1. #1
    IntensE's Avatar
    IntensE is online now Power Member
    Join Date
    Aug 2008
    Location
    thugz mansion
    Posts
    721
    Thanks
    435
    Thanked 624 Times in 259 Posts

    Default Need help with PHP script (very easy for programmers)

    Hello, I need to make a page like this one: http://mnemotechnics.org/3.1415926/t/words3.php

    But I need to do it with words in a different language and also input the number of words to display.

    So far, I made this code:

    Code:
    <?php  
    $filename = $_SERVER["DOCUMENT_ROOT"].'/test/words.txt'; 
    $number = $_POST['number'];
    if ($fileContents = file($filename)) { 
     shuffle($fileContents); 
    
    ?>
    
    <form action="." method="POST">
    <br><br>How many words to show? <input type="text" name="number"><br>
    <input type="submit" value=" Enter ">
    </form>
    
    <h2>List of words:</h2><br >
    <?php
    for ($i = 0; $i < $number; $i++) { 
      print($fileContents[$i]. '<br />'); 
     } 
    } else { 
     die('Could not get contents of: ' . $filename); 
    } 
    
    ?>
    This code displays the words ok, but they are not in a list and I need to make it like the website above with words numbered like:
    1. word1
    2. word2
    3. word-etc

    Any help ?




  2. #2
    tdivan's Avatar
    tdivan is offline Newbies
    Join Date
    Aug 2013
    Posts
    46
    Thanks
    3
    Thanked 16 Times in 14 Posts

    Default Re: Need help with PHP script (very easy for programmers)

    you need to break out into HTML you have already done this in your code with
    '<br />'

    so you just need to put in a <ol> ordered list in your PHP code
    you already have a looping for statement you just need to add your HTML elements

  3. The Following User Says Thank You to tdivan For This Useful Post:

    IntensE (12-20-2013)

  4. #3
    IntensE's Avatar
    IntensE is online now Power Member
    Join Date
    Aug 2008
    Location
    thugz mansion
    Posts
    721
    Thanks
    435
    Thanked 624 Times in 259 Posts

    Default Re: Need help with PHP script (very easy for programmers)

    thanks a lot, I figured it out !


Similar Threads

  1. Programmers: I need help with a script
    By groomsxxx in forum General Scripting Chat
    Replies: 3
    Last Post: 09-06-2011, 06:55 PM
  2. Dam,Good exercise for good script programmers.BlackHat
    By sendlerad in forum Black Hat SEO
    Replies: 7
    Last Post: 10-22-2007, 10:09 AM

Bookmarks

Posting Permissions

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




BlackHatWorld on Twitter BlackHatWorld on FaceBook


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108