I'm working on a system that would echo diff forms in case there was an error. i made a form that contain all the fields and then I made 8 more forms for each one of the fields.(if he didn't fill the first field echo $form_1; if he didn't fill the second field echo $form_2 and etc but when I try and test my code it would show a blank page.
register.php:
<?php
require 'regforms.php';
$btsubmit = isset($_POST["btsubmit"]) ;
if ($btsubmit) {
$ptuser = $_POST["ptuser"] ;
$ptemail = $_POST["ptemail"] ;
$ptveremail = $_POST["ptveremail"] ;
$ptpass = $_POST["ptpass"] ;
$ptverpass = $_POST["ptverpass"] ;
$ptsecquest = $_POST["ptsecquest"] ;
$ptsecans = $_POST["ptsecans"] ;
$cpantibot = isset($_POST['cpantibot']) ;
if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && empty($ptpass) && empty($ptverpass) && empty($ptsecquest) && empty($ptsecans) && empty($cpantibot)) {
echo $form_1;
} else if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && empty($ptpass) && empty($ptverpass) && empty($ptsecquest) && empty($ptsecans) && $cpantibot) {
echo $form_2;
} else if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && empty($ptpass) && empty($ptverpass) && empty($ptsecquest) && $ptsecans && $cpantibot) {
echo $form_3;
} else if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && empty($ptpass) && empty($ptverpass) && $ptsecquest && $ptsecans && $cpantibot) {
echo $form_4;
} else if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && empty($ptpass) && $ptverpass && $ptsecquest && $ptsecans && $cpantibot) {
echo $form_5;
} else if (empty($ptuser) && empty($ptemail) && empty($ptveremail) && $ptpass && $ptverpass && $ptsecquest && $ptsecans && $cpantibot) {
echo $form_6;
} else if (empty($ptuser) && empty($ptemail) && $ptveremail && $ptpass && $ptverpass && $ptsecquest && $ptsecans && $cpantibot) {
echo $form_7;
} else if (empty($ptuser) && $ptemail && $ptveremail && $ptpass && $ptverpass && $ptsecquest && $ptsecans && $cpantibot) {
echo $form_8;
} else if ($ptuser && $ptemail && $ptveremail && $ptpass && $ptverpass && $ptsecquest && $ptsecans && $cpantibot) {
echo 'ok';
echo $form;
}
} else {
echo $form;
}
?>
regforms.php :
<?php
$form = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_1 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
<td><font color = "red" >Checking this box is required.</font></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_2 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_3 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans" value = "$ptsecans" ></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_4 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_5 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_6 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_7 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail" value = "$ptveremail" ></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
$form_8 = '<form action = "register.php" method = "POST">
<table>
<h3>Basic information</h3>
<tr>
<td>Username : </td>
<td><input type = "text" name = "ptuser"></td>
<td><font color = "red" >This field is required.</font></td>
</tr>
<tr>
<td>Email : </td>
<td><input type = "text" name = "ptemail" value = "$ptemail" ></td>
</tr>
<tr>
<td>Verify email: </td>
<td><input type = "text" name = "ptveremail" value = "$ptveremail" ></td>
</tr>
</table>
<table>
<h3>Security information</h3>
<tr>
<td>Password : </td>
<td><input type = "password" name = "ptpass"></td>
</tr>
<tr>
<td>Verify password : </td>
<td><input type = "password" name = "ptverpass"></td>
</tr>
<tr>
<td>Security question : </td>
<td><input type = "text" name = "ptsecquest"></td>
</tr>
<tr>
<td>Security answer: </td>
<td><input type = "text" name = "ptsecans"></td>
</tr>
</table>
<table>
<h3>Verification</h3>
<table>
<tr>
<td></td>
<td><label><input type="checkbox" name="cpantibot" value="I_am_a_humin">Verify you are a humin</label></td>
</tr>
<tr>
<td></td>
<td><input type = "submit" name = "btsubmit" value = "Submit" ></td>
</tr>
</table>
</form>';
?>
` tags inside a `