Kristjan1215 Kristjan1215 - 6 months ago 24
PHP Question

PHP read text from textarea, use convert_uuencode and write it to another textarea

As i wrote in the title i need to read text, that user would input into textarea and the encode it with convert_uuencode and then write it to another textarea.

I need this for school

Right now it looks like this:

<?php
$niz = $_POST['input']);
echo $niz;
echo convert_uuencode($niz);
?>


Post read from textarea with ID input

EDIT:

<!DOCTYPE html>
<head>
<title>PHP vaja</title>
<meta charset="utf-8">
<style/type="text/css">
body { background-color:#99b3ff;}
.wrapper { text-align: center;}
.knof { position: absolute; top: 50%;}
</style>

</head>
<body>

Input:<br />
<textarea rows="7" cols="100" id="input" name="input">
Please input a message!
</textarea>

<br /><br />
<input type="submit" name="select" value="Encrypt the text" onclick="select()"/>
<br /><br />

<?php
function code(){
$niz = $_POST['input'];
echo $niz;
echo convert_uuencode($niz);
}
?>

<br />Output:<br />
<textarea rows="7" cols="100" id="output" name="output">
</textarea>

</body>
</html>


Sorry for the late post of the code, it was a bit messed up. For now it should only write out the encrypted message, later i will write it in textarea.
Page can be seen at: VISIT SCHOOL SITE WITH THIS PAGE

Answer

Ok first of all, your really should ask questions which are meant to teach you something, but I wanted to help you anyway:

<!DOCTYPE html>
<html>
    <head>
        <title>PHP vaja</title>
        <meta charset="UTF-8">
        <style type="text/css">
            body{
                background-color: #99b3ff;
            }
            .wrapper{
                text-align: center;
            }
            .knof{
                position: absolute;
                top: 50%;
            }
        </style>
    </head>
    <body>
        <form action="" method="POST" target="_self">
            <label for="input">Input</label>
            <textarea rows="7" cols="100" id="input" name="input" placeholder="Pleas input a message!"></textarea>
            <input type="submit" value="encrypt">
        </form>

        <label for="input">Output</label>
        <textarea disabled rows="7" cols="100" id="output" name="output">
            <?php
                if(isset($_POST['input'])){
                    echo convert_uuencode($_POST['input']);
                }
            ?>
        </textarea>     
    </body>
</html>