Im trying to call a function within a form element, could someone show me how to do so, here's my html form and PHP script:
Code: Select all
<form action="blah.php" method="post"> <-- may not be needed
Laboratory:
<div style='border:#323E4A 1px solid;width:400;height:80;color:#AAC9E8'>
<table border=0 cellpadding=0 cellspacing=0>
<td width=400 height=80>Code: Select all
<?php
function chk() {
$try = $_POST['test'];
$answer = "apple";
$right = "right";
$wrong = "wrong";
if ($answer != $try) {
echo "".$wrong."";
} else {
echo "".$right."";
}}
?>Code: Select all
</td>
</table>
</div>
<table border=0 cellpadding=0 cellspacing=0>
<td>
<input type="text" name="test">
<input type="submit" name="sub" value="Inject">
</td>
</table>
</form>