HTML form tags (+ function) with PHP?
Posted: Tue Apr 20, 2010 6:21 am
Hi,
I have a problem with a PHP task. I'm completely new to this and really have no clue how to solve this. It can't be that hard? It's a HTML form, I have two "option value" with "crypt" and "decrypt" and when I pick crypt I want a function to execute (show the crypt text from the text input box) after clicking OK. When I pick decrypt I want another function to execute (show the decrypt text from the text input). How do you solve this, how do I read HTML form tags with PHP? It works now, but the form shows both of them. All I want to do is to connect the php functions to the two different values. Does anyone know how to do this?
I have a problem with a PHP task. I'm completely new to this and really have no clue how to solve this. It can't be that hard? It's a HTML form, I have two "option value" with "crypt" and "decrypt" and when I pick crypt I want a function to execute (show the crypt text from the text input box) after clicking OK. When I pick decrypt I want another function to execute (show the decrypt text from the text input). How do you solve this, how do I read HTML form tags with PHP? It works now, but the form shows both of them. All I want to do is to connect the php functions to the two different values. Does anyone know how to do this?
Code: Select all
<?php
$message = $_POST["message"];
?>
(......... function code etcetc.)
<h2>Test 1</h2>
<form method="post" action="myform.php">
<textarea name="message" size="5" rows="2" cols="30"></textarea><br/><br/>
<select name="process">
<option value="crypt">Encrypt</option>
<option value="decrypt">Decrypt</option>
</select>
<input type="submit" value="Utför" name="submit">
</form>
<b>Crypt:</b> <?php CaesarCipher($message) ?><br/>
<b>Decrypt:</b> <?php CaesarCipher2($message) ?><br/>
</body>
</html>