/    Sign up×
Community /Pin to ProfileBookmark

urgent plz help

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>

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @tushar123 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...