I am trying to integrate a captchia code with using a form. What I have is a basic format to where I was able to get the captcha part working on its own php page. Also I was able to display a form in its own php page. The problem I am having is I'm not sure how to get both parts working together.
This is a snipit of what I have:
<?php
session_start();
if (isset($_POST['captcha'])) {
$_SESSION['captcha'] = rand(0, 99999999999);
} else {
if ($_SESSION['captcha']!==$_POST['captcha']) {
echo 're-enter a new captcha!';
$_SESSION['captcha'] = rand(0, 99999999999);
}
}
?>
<form action="formx.php" method="POST">
<ul>
<li>
Username:<br>
<input type"text" name="username">
</li>
<li>
Password:<br>
<input type="password" name="password">
</li>
<li>
Password again:<br>
<input type="password" name="password2">
</li>
<li>
Email:<br>
<input type="text" name="email">
</li>
<li>
<input type="submit" name="captcha" value="submit">
</li>
</ul>
</form>