i am new to php and below is the code i am writing for a sensor system.i am not abel to get the value of groupnumber variable after posted01.can any one help me.thanx in advance….
<html>
<head>
</head>
<body bgcolor=”gray”>
<h3><center> Welcome </center></h3>
<?php
function groupnumber(){
echo “<form action=’test1.php’ method=’POST’>”; echo “<input type=’hidden’ name=’posted’ value=’true’/><br/>”;
echo “Number of Groups”;
echo “<input type=’text’ name=’groupnom’><br/>”; echo “<input type=’submit’ value=’Submit’><br/>”; echo “</form>”;
}
function groupname($groupnom){
global $groupnom;
echo “<form action=’test1.php’ method=’POST’>”;
echo “<input type=’hidden’ name=’posted01′ value=’true’/><br/>”;
for($i=1;$i <= $groupnom;$i++)
{
echo”Please enter the name of Group $i”;
echo”<input type=’text’ name=’grpname[]’>”;
}
echo “<input type=’submit’ value=’submit’>”; echo “</form>”;
}
function sensornum($groupnom){
global $groupnom;
echo “<form action=’test1.php’ method=’POST’>”;
echo “<input type=’hidden’ name=’posted02′ value=’true’><br/>”;
for($i=1;$i <= $groupnom;$i++)
{
echo “Please enter number of sensors for Group $i *”;
echo “<input name=’sensor[]’ type=’text’>”;
}
echo “<input type=’submit’ value=’submit’>”; echo “</form>”;
}
function info_display($groupnom,$grpname,$sensor){
global $groupnom,$grpname,$sensor;
echo “<table border=1>”;
echo “<tr><td><h4><font color= Black>Group Name</font></td>”;
echo “<td></td>”;
echo “<td><h4><font color= Black>Number of sensors</font></td></tr>”;
echo “</table>”;
$count=0;
do
{
//$group_name=$_POST[‘grpname’][$count];
//$sensor_number=$_POST[‘sensor’][$count];
//echo “<br><b>$group_number</b></br>”;
//echo “<br><b>$sensor_number</b></br>”; $checkempty = $sensor;
$count = $count + 1;
echo “<table border=1>”;
echo “<tr><td><font color= Black>$grpname</font></td>”;
for($i=1;$i<=$sensor;$i++)
{
echo “<td><font color= black>$i</font></td>”; }
echo “</tr>”;
echo “</table>”; }while($checkempty !=””);
}
$groupnom=$_POST[‘groupnom’];
$grpname=$_POST[‘grpname’];
$sensor=$_POST[‘sensor’];
//echo $_POST[‘groupnom’];
//echo $_POST[‘grpname’];
//echo $_POST[‘sensor’];
if(isset($_POST[‘posted’])){
print groupname($_POST[‘groupnom’]);
}
else
if(isset($_POST[‘posted01’])){
print sensornum($_POST[‘groupnom’]);
}
else
if(isset($_POST[‘posted02’])){
info_display($_POST[‘groupnom’],$_POST[‘grpname’],$_POST[‘sensor’]);
}
else
{
echo groupnumber(); }
?>
</body>
</html>