Jump to content

Word cloud


stof01

Recommended Posts

Hi

 

Im having some trouble trying to do the following...

 

My first page will have a text box where a user can enter no less than a hundred words.The user clicks submit and it gets passed into array and the next page displays the word cloud.

 

Any help would be great

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.