I enter into word1 word2 zeros and ones, xor-th them, and I bring in result by pressing decrypt should xor be word2 and result, it sometimes works fine, and sometimes the values of the cells themselves change
<?php if ($_POST['submit']) { $Word1 = $_POST['Word1']; $Word2 = $_POST['Word2']; $result = $_POST['result']; $i = 0; while ($i < strlen($Word1)) { if ($Word1{$i} == $Word2{$i}) { $result = $result . "0"; } else { $result = $result . "1"; } $i++; } } if ($_POST['Erase']) { $result = ""; $Word1 = ""; $Word2 = ""; $Decrypt = ""; } if ($_POST['Decrypt']) { $Word2 = $_POST['Word2']; $result = $_POST['result']; $j = 0; while ($j < strlen($Word2)) { if ($Word2{$j} == $result{$j}) { $Decrypt = $Decrypt . "0"; } else { $Decrypt = $Decrypt . "1"; } $j++; } } ?> <form action="" method="post"> <br/>word1<br/> <textarea rows="1" cols="100" name="Word1"><?= $Word1 ?></textarea> <br/><br/>word2<br/> <textarea rows="1" cols="100" name="Word2"><?= $Word2 ?></textarea> <br/><br/>result<br/> <textarea rows="1" cols="100" name="result"><?= $result ?></textarea> <br/> <input type="submit" name="submit"value="Convert"> <input type="submit" name="Erase" value="Erase"> <input type="submit" name="Decrypt" value="Decrypt"> <br/><br/>Decrypt<br/> <textarea rows="1" cols="100" name="result"><?= $Decrypt ?></textarea> <br/> </form>
if(isset($_POST['submit']))if(isset($_POST['Erase']))if(isset($_POST['Decrypt']))- Mr. Black