Jump to content

Word cloud


stof01

Recommended Posts

Sounds like your trying to get a tag cloud going. There are hundreds to thousands of tutorials showing you how to do that.

 

But your actual question is a straight forward textarea form that takes the words and breaks them up into an array like so....

 

<?php
if(isset($_POST['submitForm'])){
	$words = explode(',', $_POST['words']);

	echo '<pre>';
		print_r($words);
	echo '</pre>';
}
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
   <label>Enter your tags/words. Seperate them with a comma (,).<br />
      <textarea name="words" cols="80" rows="8" id="words" ></textarea><br />
   </label>
   <input type="submit" name="submitForm" value="Submit Words" />
</form>

 

results look like this.

Array
(
    [0] => bob
    [1] =>  steve
    [2] =>  john
    [3] =>  dog
    [4] =>  cat
    [5] =>  bird
    [6] =>  car
    [7] =>  this
    [8] =>  that
    [9] =>  cake
    [10] =>  face
    [11] =>  grass
    [12] =>  pot
    [13] =>  pan
    [14] =>  dish
    [15] =>  baby
    [16] =>  joe
    [17] =>  van
    [18] =>  bus
    [19] =>  form
    [20] =>  field
    [21] =>  button
    [22] =>  cat
)

 

Nate

Link to comment
https://forums.phpfreaks.com/topic/157595-word-cloud/#findComment-831246
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.