<html>
<head>
	<title></title>
</head>
<body>

<?php

    
    
    
    
    
    
//6. (Bonus) If there is something that has a www, add a hyperlink around it if it does not exist.
$area6 = $_POST['area6'];
    var_dump($area6);
//I need to look at every single word in this post and see if there is a www    
/*
$words = explode(' ',$area6);
    //need to loop!!!
    for ($i=0;$i<count($words);$i++){
        if (strpos($words[$i],'www') !== false){
                    echo $words[$i].'<br>';
                   if (strpos($words[$i],'<a ') === false)
                     echo str_replace($words[$i],'<a href="http://'.$words[$i].'">'.$words[$i].'</a>',$area6);  
                       
                       //if no hyperlink!! Then str_replace w hlink 
                       
                    
        }     
              
    }*/


    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
};
?>

<div id="menu"></div>

<div id="intro">
You will use PHP to protect the following WYSIWYG Forms

</div>
<br />

<div id="sample">
<script type="text/javascript" src="../nicEdit.js"></script>
<script type="text/javascript">
	bkLib.onDomLoaded(function() { nicEditors.allTextAreas() });
</script>

<form action="hw2.php" method="post">
<h4>1. Strip all html tags from this submission and remove white space from both sides of the submission</h4>
<textarea name="ta1" style="width: 300px; height: 100px;" ></textarea>
<br />
    
<h4>2. Only allow image and anchor tags.</h4>
<textarea name="area2" style="width: 300px; height: 100px;">

</textarea>
<br />

<h4>3. Output the number of words in the post.</h4>
<textarea name="area3" style="width: 300px; height: 100px;">

</textarea>
<br />

<h4>4. URL encode all hyperlinks.</h4>
<textarea name="area4" style="width: 300px; height: 100px;">

</textarea>
<br />

<h4>5. Make all words title case</h4>
<textarea name="area5" style="width: 300px; height: 100px;">

</textarea>
<br />


<h4>6. (Bonus) If there is something that has a www, add a hyperlink around it if it does not exist. </h4>
<textarea name="area6" style="width: 300px; height: 100px;">
  


</textarea>
<input type="submit" name="submit" value="submit">



</form>
</div>   
</body>
</html>