Results 1 to 2 of 2

Thread: How do you change data(PHP)

  1. #1
    Join Date
    Mar 2006
    Posts
    177

    How do you change data(PHP)

    Lets say i have a form thats comes in assigned to a variable, the user entered a zip code. Maybe 25637 for example. I want to be able get the first 3 of those 5 digits (256), how do i do that? where can i find the commands on how to edit user entered data.

    i found one way, you can do a [1] [2] [3]
    Last edited by Compumaniac12; 08 Nov 2006 at 06:59 PM.
    I Am Currently Available For Work
    -------------------------------

  2. #2
    Join Date
    Oct 2006
    Location
    UK - Wales
    Posts
    72
    this will split a string after a certain number of chararters - there are other ways of spliting string so try searching workwrap() or split() and you should find something that could help.

    <?php

    $text = "25637"; //zip code entered
    $newtext = wordwrap($text, 3, " ", 1); //split the text after 3 characters - seporate with a space

    echo "$newtext"; //display the message

    ?>

    this will display "256 37" tho which i think is not quite want you want.

Similar Threads

  1. Strange change in link popularity
    By priyanka in forum Search Engine Optimization and Marketing
    Replies: 1
    Last Post: 22 Jul 2005, 08:07 AM

Posting Permissions

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