SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML Form inside PHP

    Hello.


    I've got a slugify word function :

    PHP Code:
      static public function slugify($text)
      { 
        
    $text str_replace(" ""_"$text);
        

        
    $text str_replace(","""$text);
        
    $text str_replace("."""$text);


        
    // replace non letter or digits by -
        
    $text preg_replace('~[^\\pL\d_]+~u''-'$text);

        
    // trim
        
    $text trim($text'-');

        
    // transliterate
        
    $text iconv('utf-8''us-ascii//TRANSLIT'$text);

        
    // lowercase
        
    $text strtolower($text);

        
    // remove unwanted characters
        
    $text preg_replace('~[^-\w]+~'''$text);

        if (empty(
    $text))
        {
          return 
    'n-a';
        }

        return 
    $text;

      } 

    my question is , if possible is to slugify a word typed in html input (text) and then update a form with a converted word? of course all the action after pressing buttong "submit".


    e.g.

    We've got a word : Ri ch, a.r.d,

    After a function its converted to a Richard

    Converting is pretty easy , but it's possible to update a html input with php?
    I know that JQuery provide this issue , but I would like to do it in PHP.

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I fixed it , btw if anyone is interested :

    After slugify a word pass it to a variable then as a html form value.


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
  •