i am doing a crime management web application using php.
The page is like this when run it,it gives a chance to enter Details about the case,then click on submit button it brings another form on the same page.
that Form will ask you to enter the number of accused involved,if lets say for instance you have two accused,it will bring another form on the same page that will allow you to enter personal data bout accused number one ...then click on submit button it bring you another form that asks you to enter the number of crimes accused number one has committed...if lets say again he committed 3 crimes then it brings a select form which allows you to select the crime and submit 3 times.
After the third entry it will go back again and give you a form to enter personal details about accused number two....same process as accused one an when you are done it takes you back to the initial point where it would be ready to enter a new case
i pray its clear....please help
this is my earlier code ...ready to run
<?php
session_start();
if(isset($_SESSION["start"]))
{
switch($_SESSION["now"])
{
case 0:
$_SESSION["now"]++;
echo " <p style='text-align:center;'><H1> ==Welcom Page, you need to start here==</h1></p>
<br><br><br><br>
<form action='index.php' method='post' name='page'>
<p h3>Please Enter your max number....
<input type='number' name='max' style='width:140px;' required='required'/>
<input type='submit' name='GO'></p>
</form>";
break;
case 1:
if(isset($_POST[max]))
{
$_SESSION["end"]=$_POST[max];
echo "<p style='text-align:center;'><H2> Sequence 1</h1></p>
<form action='index.php' method='post' name='page'>
value 1: <input type='text' name='x' style='width:140px;'/><br>
value 2: <input type='text' name='y' style='width:140px;'/><br>
value 3: <input type='text' name='z' style='width:140px;'/><br>
<p style='text-align:center'><input type='submit' name='Next'>
</form>";
$_SESSION["now"]++;
}
else
{
if($_SESSION["now"]==1)
{
$_SESSION["now"]=0;
header( "Location: index.php");
exit;
}
}
break;
default:
if($_SESSION["now"]<=$_SESSION["end"])
{
$x=$_SESSION["now"];
$_SESSION["now"]++;
echo "<p style='text-align:center;'><H2> Sequence $x</h1></p>
<form action='index.php' method='post' name='page'>
value 1: <input type='text' name='x' style='width:140px;'/><br>
value 2: <input type='text' name='y' style='width:140px;'/><br>
value 3: <input type='text' name='z' style='width:140px;'/><br>
<p style='text-align:center'><input type='submit' name='Next'>
</form>";
}
else
{
echo "<p style='text-align:center;'><H2> Successful, Please refresh the page to restart your sequence ...</h1></p>";
session_destroy();
}
}
}
else
{
$_SESSION["start"]=true;
$_SESSION["now"]=0;
header( "Location: index.php");
exit;
}
?>