0

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.

Edited by pauls9: n/a

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by phorce
0

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);
   }
   
 ?>

Edited by phorce: n/a

0

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

1

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 :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.