Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Nov 2004
    Posts
    6
    Member #
    8093
    Hello,

    I am creating a website using Dreamweaver MX. :alien: The web design is doing ok and I have created the home page. My website is a small business uniquely for teenagers. It will allow them to submit their school papers so I and perhaps some of my associates can proofread and correct them.

    I am having some major organizational problems with the Submit Paper page, in where they submit and pay for my services. I would like people to enter/copy the document into a field submit box, which will be limited to 8,000 words or less, and their email. Then I would like to have a PHP function in where it calculates the number of words submitted and gives a price on a different page.

    Afterwards, they either choose to pay through Paypal or they cancel it. If they cancel, the document is not sent to my email, and if it is then they pay and the document and money is sent.

    I will charge a specific amount for a certain amount of words and therefore I need a PHP function in where the number of words are calculated and refusal if it exceeds a certain amount of words.

    I would appreciate if someone could help me figure out how to set me up. I do not want any html code or complicated technical PHP, I would just like consulting on how I would do this and maybe some of my options.


    I'd prefer everything posted here, but if anyones prefers just email or IM me on MSN.

    paravach@hotmail.com


    MIKE

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    [phpfunction]str_word_count[/phpfunction]

    str_word_count
    (PHP 4 >= 4.3.0, PHP 5)

    str_word_count -- Return information about words used in a string

    Description

    Counts the number of words inside string. If the optional format is not specified, then the return value will be an integer representing the number of words found. In the event the format is specified, the return value will be an array, content of which is dependent on the format. The possible value for the format and the resultant outputs are listed below.

    mixed str_word_count ( string string [, int format])
    1. returns an array containing all the words found inside the string.
    2. returns an associative array, where the key is the numeric position of the word inside the string and the value is the actual word itself.


    For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with "'" and "-" characters.

    Example 1. Example uses for str_word_count()
    PHP Code:
    <?php

    $str 
    "Hello friend, you're
           looking          good today!"
    ;

    $a  str_word_count($str1);
    $b  str_word_count($str2);
    $c  str_word_count($str);

    print_r($a);
    print_r($b);
    echo 
    $c;
    ?>


    Output may look like:
    Array
    (
    [0] => Hello
    [1] => friend
    [2] => you're
    [3] => looking
    [4] => good
    [5] => today
    )

    Array
    (
    [0] => Hello
    [6] => friend
    [14] => you're
    [29] => looking
    [46] => good
    [51] => today
    )

    6
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Junior Member
    Join Date
    Nov 2004
    Posts
    6
    Member #
    8093
    Oh cool! Thanks for the code, didn't know it existed. :laugh:

  5. #4
    Senior Member Physt's Avatar
    Join Date
    Jul 2004
    Posts
    255
    Member #
    6655
    It would be cool if you could just upload the txt or doc file, too.. You can easily check file size.. Cool service too
    www.controlalternate.com - Web resources and free templates. www.chaosconcepts.net - Custom web and graphic design.
    www.blog.chaosconcepts.net - My Blog

  6. #5
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    Copy and paste is easier IMHO.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  7. #6
    Senior Member tibberous's Avatar
    Join Date
    Aug 2003
    Posts
    195
    Member #
    2535
    Copy and paste is really kinda limiting though, in that everything like formatting, images, charts, ect are all gone. For straight essays this wouldn't be to bad, but you'll have a hard time with reports and such.

    I found this windows only code and can't vouch for how good it works but you might want to try this:

    PHP Code:
    $word = new COM("word.application") or die("Unable to instantiate Word"); 

    $word->Visible 1


    $word->Documents->Open("c:\anydoc.doc");
    $temp $word->Dialogs->Item(228); // returns wdDialogToolsWordCount dialog object
    $temp->Execute();    //updates the word count
    $numwords $temp->Words();    //gets the words out of it

    echo 'Word count = '.$numwords;

    $word->Quit(); 
    I'd give it a try...


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:23 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com