HI.
I have a working class to scan a text, separate each word, and analyse each one individually. My next step is to create a form for users to submit their text to be analysed and outputted by my PHP class. I have successfully created the form and linked to my PHP class.
Here is my form:
<form name="postagger" action="postagger.php" method="POST">
<textarea name="Text to tag" rows="10" cols="60">Enter your text to tag here</textarea><br />
<input type="submit" />
</form>
postagger.php uses a print function to output data after the input has been parsed. I’m having trouble using the inputted form text with the print function. The relevant part of postagger.php looks like this:
[php]<?php
// little helper function to print the results
function printTag($tags) {
foreach($tags as $t) {
echo ‘’;
echo $t[‘token’] . " ";
echo ‘’;
}
echo “\r\n”;
}
$tagger = new PosTagger(‘lexicon.txt’);
?>[/php]
The print function ^^.
[php]<?php
//Check whether the form has been submitted
if (array_key_exists(‘check_submit’, $_POST)) {
$tags = $tagger->tag {$_POST[‘Text to tag’]};
printTag($tags);
} else {
echo ‘Something went wrong!’;
}
?>[/php]
How I’m currently trying to process the form input text^^ which is not working, as I’m getting “Something went wrong” output!
Any help would be much appreciated. Thanks (Hope I explained clearly enough)