tyra Posted April 17, 2009 Share Posted April 17, 2009 Hi guys! Text input file looks like this: Code: <?php if($_POST['text'] != null){ echo 'Entered text: '.$_POST['text']; }else{ echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">Enter text:<input type="text" name="text"><input type="submit" value="Submit"></form>'; } ?> But how to double it and then set to compare eachothers submitted data ? The goal is to have 2 textareas. Area1, area2 where text entered to area2 is compared with text from area1 and text entered to area1 is compared with text from area2. Differences will be marked bold after submitting. exaple: before submiting: textarea1: NASA textarea2: NASCAR after submiting: textarea1: NASA textarea2: NASCAR Link to comment https://forums.phpfreaks.com/topic/154570-compare-data/ Share on other sites More sharing options...
jackpf Posted April 18, 2009 Share Posted April 18, 2009 You could split each input into an array of each letter. Then compare each letter with it's corresponding letter. If they match, add the letter to a new array, if they don't add it to the new array along with a font-weight tag. Then echo both arrays. Link to comment https://forums.phpfreaks.com/topic/154570-compare-data/#findComment-812857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.