I need to get values from a textfield and put it in a function, this can be done pressing enter or clicking in a button that insert the value of the textfield in the said function.

I don't get what you mean by "put it into a function", but I'll have a go :)

<?php

   function returnText($theText)
   {
   		return $theText;
   }
   
   if(!isset($_POST['submitted'])) { // check that form hasn't been submitted 
      echo '<form method="post" action="">';
      echo 'Enter something: <input type="text" name="theInput" value="" />';
      echo '<input type="submit" name="submit" value="Go!">';
      echo '<input type="hidden" name="submitted" value="TRUE" />';
      echo '</form>';
   }else{
   
   	  $text = $_POST['theInput'];
   
   	  echo $text; // this will display the text.
   	  
   	  echo returnText($text);
   }
   
 ?>

thats exactly what I was looking for, everything is clear now thanks.

If this has now been solved, please mark it as solved and give rep points (use the arrows next to someones name)

Thanks and good luck :)