FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » validation of a text box input...
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
validation of a text box input... [message #180777] Mon, 18 March 2013 15:46 Go to next message
Nagaraju Kachapuram is currently offline  Nagaraju Kachapuram
Messages: 14
Registered: February 2013
Karma: 0
Junior Member
Hi,

I have created a text box to take input to open another form. If the text box is not given any value and press enter it is activating the linked form with empty values. How to validate the text box not accept the null value. I tried with isset() function but i dont know how to apply it. The following is some part of my text box code .



<form name="myform" action="nextform.php?id=<?php echo $id; ?>" method="GET">
<li><a ><b>ID Code:</b><br/><input type="text" color:'red' style="width:10em" maxlength=9 name=id onfocus="if (this.value == 'Enter ID Code') {this.value = '';}"></a>
<?php echo $id ?>

</li>
<li>
<input type="submit" value="submit" style="margin-left:4.5em;color:#be1400;">
</li>

Where is the error?

Thank you.
Re: validation of a text box input... [message #180779 is a reply to message #180777] Mon, 18 March 2013 18:19 Go to previous messageGo to next message
Salvatore is currently offline  Salvatore
Messages: 38
Registered: September 2012
Karma: 0
Member
On 2013-03-18, nag <visitnag(at)gmail(dot)com> wrote:
> Where is the error?

Could you share with us the PHP code, and not just the HTML code? We
can't find an error with PHP code if you don't show us first.

--
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
Re: validation of a text box input... [message #180780 is a reply to message #180777] Mon, 18 March 2013 19:28 Go to previous messageGo to next message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 18/03/13 16:46, nag wrote:
> Hi,
>
> I have created a text box to take input to open another form. If the text box is not given any value and press enter it is activating the linked form with empty values. How to validate the text box not accept the null value. I tried with isset() function but i dont know how to apply it. The following is some part of my text box code .
>
>
>
> <form name="myform" action="nextform.php?id=<?php echo $id; ?>" method="GET">
> <li><a ><b>ID Code:</b><br/><input type="text" color:'red' style="width:10em" maxlength=9 name=id onfocus="if (this.value == 'Enter ID Code') {this.value = '';}"></a>
> <?php echo $id ?>
>
> </li>
> <li>
> <input type="submit" value="submit" style="margin-left:4.5em;color:#be1400;">
> </li>
>
> Where is the error?

http://www.php.net/manual/en/function.empty.php

if(!empty($_GET['id'])) {

}

You should have all values quoted and you shouldn't mix quote types,
there is a closed source browser that people use even if it's extremely
buggy which may fail to work properly when mixing quotes. Also validate
your HTML code with a validator, w3c has one if your IDE don't have one
built in.


--

//Aho
Re: validation of a text box input... [message #180784 is a reply to message #180779] Mon, 18 March 2013 23:54 Go to previous messageGo to next message
Nagaraju Kachapuram is currently offline  Nagaraju Kachapuram
Messages: 14
Registered: February 2013
Karma: 0
Junior Member
On Monday, 18 March 2013 23:49:46 UTC+5:30, Salvatore wrote:
> On 2013-03-18, nag <visitnag(at)gmail(dot)com> wrote:
>
>> Where is the error?
>
>
>
> Could you share with us the PHP code, and not just the HTML code? We
>
> can't find an error with PHP code if you don't show us first.
>
>
>
> --
>
> Blah blah bleh...
>
> GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++

Here is my index.php and club.php code. Thank you for the help


<html>
<head>
<?
include("visitors.php");
?>
<?php
// To add hit counter

$count_my_page=("counter.txt");
$hits=file($count_my_page);
$hits[0]++;
$fp=fopen($count_my_page,"w");
fputs($fp , "$hits[0]");
fclose($fp);

?>
<title> Club Membership Analysis </title>
<!--<body bgcolor="#779988"> -->
<body bgcolor="#006c92">
<script type="text/javascript">
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
<style type="text/css">
body {
font: normal 11px verdana;
}

ul {
margin: 0;
padding: 0;
list-style: none;
width: 189px;

}

ul li {
position: relative;
z-index:9999;
}

li ul {
position: absolute;
left: 155px;
top: 0;
display: none;
}


ul li a {
display: block;
text-decoration: none;
color: #221;
background: #f5f5dc;
padding: 6px;
border: 1px solid #006c92;
border-bottom: 2;
width: 135px;
border: 1px solid #006c92;
padding: 5px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(/pie/PIE.htc);
}

li:hover ul, li.over ul { display: block; }


</style>
</head>
<body>


<span style="background-color:#333; width:3em; height:2em; float:left; color:#FFF; font-size:40px;"><img src="img/logo-flag.gif" height="90px" width="150px"> </span>

<span style="width:3em; height:2em; float:left; margin-left:17%; color:#FFF; font-size:40px; position:float; top ; 0 ; center"><img src="img/cma-black-glow.png" height="110px" width="460px" border="0"> </span>

<span style="background-color:#333; width:3em; height:2em; float:right; color:#FFF; font-size:40px; margin-right:30"><img src="img/logo-flag.gif" height="90px" width="150px"> </span>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<hr size="5" color="pink">
<p style="text-align: center; "><font color="white" size="2"><table align="center"><tr><td><marquee behaviour="alternate" scrollamount="1" scrolldelay="15"><font color="yellow">scrolling message....</marquee></table></tr></td></font></p>

<span class="null" style="float:left; clear:both; width:20%; height:4%; margin-top:-3%;">
<ul id="nav" style="float:left; clear:both;" name="br" onChange="submit(this.form)">
<br>
<li><a href="#"><b><font color="#ff0000" size='2'>Branch List</b></a>
<ul>
<li ><a href="clubmain.php?br=60C ">some sub menu</a></li>
</ul>
</li>
<form name="myform" action="club.php?agnt=<?php echo $agnt; ?>" method="GET">
<li><a ><b>Agent Code:</b><br/><input type="text" color:'red' style="width:10em" maxlength=9 name=agnt onfocus="if (this.value == 'Enter Agent Code') {this.value = '';}"></a>
<?php echo $agnt ?>
<!-- this ref to present element -->

</li>
<li>
<input type="submit" value="submit" style="margin-left:4.5em;color:#be1400;">
</li>
<br>
<div style="background-color:#ffffcc; width:146px;height:165px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(PIE.htc);">
<br>
<br>
<a class="leftMenu" ><b><font color="black" size='2'>Top 25 Agents On</a><br/>
<a class="leftMenu" href="top-agents-pols.php"><b><font size='2' color="blue">Policies</a>
<a class="leftMenu"><font color="blue">&nbsp&nbsp</a>
<a class="leftMenu" href="top-agents-prem.php"><font color="blue">Premium</a><br>
<br>
<a class="leftMenu" ><font color="black">Top 25 CLIAs On</a><br/>
<a class="leftMenu" href="top-clias-pols.php"><font color="blue">Policies</a>
<a class="leftMenu"><font color="blue">&nbsp&nbsp</a>
<a class="leftMenu" href="top-clias-prem.php"><font color="blue">Premium</a><br/><html>
<head>
<?
include("visitors.php");
?>
<?php
// To add hit counter

$count_my_page=("counter.txt");
$hits=file($count_my_page);
$hits[0]++;
$fp=fopen($count_my_page,"w");
fputs($fp , "$hits[0]");
fclose($fp);

?>
<title> Club Membership Analysis </title>
<!--<body bgcolor="#779988"> -->
<body bgcolor="#006c92">
<script type="text/javascript">
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>
<style type="text/css">
body {
font: normal 11px verdana;
}

ul {
margin: 0;
padding: 0;
list-style: none;
width: 189px;

}

ul li {
position: relative;
z-index:9999;
}

li ul {
position: absolute;
left: 155px;
top: 0;
display: none;
}


ul li a {
display: block;
text-decoration: none;
color: #221;
background: #f5f5dc;
padding: 6px;
border: 1px solid #006c92;
border-bottom: 2;
width: 135px;
border: 1px solid #006c92;
padding: 5px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(/pie/PIE.htc);
}

li:hover ul, li.over ul { display: block; }


</style>
</head>
<body>


<span style="background-color:#333; width:3em; height:2em; float:left; color:#FFF; font-size:40px;"><img src="img/logo-flag.gif" height="90px" width="150px"> </span>

<span style="width:3em; height:2em; float:left; margin-left:17%; color:#FFF; font-size:40px; position:float; top ; 0 ; center"><img src="img/cma-black-glow.png" height="110px" width="460px" border="0"> </span>

<span style="background-color:#333; width:3em; height:2em; float:right; color:#FFF; font-size:40px; margin-right:30"><img src="img/logo-flag.gif" height="90px" width="150px"> </span>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<hr size="5" color="pink">
<p style="text-align: center; "><font color="white" size="2"><table align="center"><tr><td><marquee behaviour="alternate" scrollamount="1" scrolldelay="15"><font color="yellow">scrolling message....</marquee></table></tr></td></font></p>

<span class="null" style="float:left; clear:both; width:20%; height:4%; margin-top:-3%;">
<ul id="nav" style="float:left; clear:both;" name="br" onChange="submit(this.form)">
<br>
<li><a href="#"><b><font color="#ff0000" size='2'>Branch List</b></a>
<ul>
<li ><a href="clubmain.php?br=60C ">some sub menu</a></li>
</ul>
</li>
<form name="myform" action="club.php?agnt=<?php echo $agnt; ?>" method="GET">
<li><a ><b>Agent Code:</b><br/><input type="text" color:'red' style="width:10em" maxlength=9 name=agnt onfocus="if (this.value == 'Enter Agent Code') {this.value = '';}"></a>
<?php echo $agnt ?>
<!-- this ref to present element -->

</li>
<li>
<input type="submit" value="submit" style="margin-left:4.5em;color:#be1400;">
</li>
<br>
<div style="background-color:#ffffcc; width:146px;height:165px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(PIE.htc);">
<br>
<br>
<a class="leftMenu" ><b><font color="black" size='2'>Top 25 Agents On</a><br/>
<a class="leftMenu" href="top-agents-pols.php"><b><font size='2' color="blue">Policies</a>
<a class="leftMenu"><font color="blue">&nbsp&nbsp</a>
<a class="leftMenu" href="top-agents-prem.php"><font color="blue">Premium</a><br>
<br>
<a class="leftMenu" ><font color="black">Top 25 CLIAs On</a><br/>
<a class="leftMenu" href="top-clias-pols.php"><font color="blue">Policies</a>
<a class="leftMenu"><font color="blue">&nbsp&nbsp</a>
<a class="leftMenu" href="top-clias-prem.php"><font color="blue">Premium</a><br/>
</div>
<br>
<div style="background-color:#ffffcc; width:146px;height:48px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #006c92;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#006c92), to(#006c92));
background: -webkit-linear-gradient(#006c92, #006c92);
background: -moz-linear-gradient(#006c92, #006c92);
background: -ms-linear-gradient(#006c92, #006c92);
background: -o-linear-gradient(#006c92, #006c92);
background: linear-gradient(#006c92, #006c92);
-pie-background: linear-gradient(#006c92, #006c92);
behavior: url(PIE.htc);">
<a ><font color="black"><?php echo 'visitors online : ' . $i . '</br>';?>
<a ><?php echo ' Total visits : ' . $hits[0];?>
</div>
</ul>
<br>
<br>
<div style="margin-left:167%; margin-right:auto; margin-top:-5%; height:230px; width:190px"><img height="300px" width="350px" src="img/lic-56.png"> </div>
</span>
<div class="subMenu" style="float:right; margin-top:-1%;">
<div style="background-color:#ffffcc; width:146px;height:345px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 175px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(PIE.htc);">
<br>
<a class="leftMenu" href="branchwise.php"><font color="black" size='2'><b>Branch-wise No.of Club Members</b></a><br/>
<br>
<a class="leftMenu" href="lapseratio.pdf"><font color="cc3300">Lapse Ratio </a><br/>
<br>
<a class="leftMenu" href="club-benefits-modi.pdf"><font color="black">Club Member Benefits</a><br/>
<br>
<a class="leftMenu" href="index1.php"><font color="#ff0000">High Lapse Ratio Club Agents</a><br/>
<br>
<a class="leftMenu" href="dowise.php"><font color="black">Top 50 DOs Club Member Wise</a><br/>
<br>
<a class="leftMenu" href="lexpiry.php"><font color="ff0000">Agents Licence Expiry</a><br/>
<br>
<a class="leftMenu" href="revived_stats.php"><font color="black">Revival Heros</a><br/>
</div>
<span style="position:fixed;bottom:0;left:0;width:100%;text-align:center;"><font color="#97a8ab">Best viewed in mozilla firefox<br>Post suggestions to blah(at)blah(dot)com<font/></span>
</body>
</html>
</div>
<br>
<div style="background-color:#ffffcc; width:146px;height:48px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 155px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #006c92;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#006c92), to(#006c92));
background: -webkit-linear-gradient(#006c92, #006c92);
background: -moz-linear-gradient(#006c92, #006c92);
background: -ms-linear-gradient(#006c92, #006c92);
background: -o-linear-gradient(#006c92, #006c92);
background: linear-gradient(#006c92, #006c92);
-pie-background: linear-gradient(#006c92, #006c92);
behavior: url(PIE.htc);">
<a ><font color="black"><?php echo 'visitors online : ' . $i . '</br>';?>
<a ><?php echo ' Total visits : ' . $hits[0];?>
</div>
</ul>
<br>
<br>
<div style="margin-left:167%; margin-right:auto; margin-top:-5%; height:230px; width:190px"><img height="300px" width="350px" src="img/lic-56.png"> </div>
</span>
<div class="subMenu" style="float:right; margin-top:-1%;">
<div style="background-color:#ffffcc; width:146px;height:345px;border: 1px solid #696;
5adding: 15px 0;
text-align: center; width: 175px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 15px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #FFFF90;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFF90), to(#FFFF90));
background: -webkit-linear-gradient(#FFFF90, #FFFF90);
background: -moz-linear-gradient(#FFFF90, #FFFF90);
background: -ms-linear-gradient(#FFFF90, #FFFF90);
background: -o-linear-gradient(#FFFF90, #FFFF90);
background: linear-gradient(#FFFF90, #FFFF90);
-pie-background: linear-gradient(#FFFF90, #FFFF90);
behavior: url(PIE.htc);">
<br>
<a class="leftMenu" href="branchwise.php"><font color="black" size='2'><b>Branch-wise No.of Club Members</b></a><br/>
<br>
<a class="leftMenu" href="lapseratio.pdf"><font color="cc3300">Lapse Ratio </a><br/>
<br>
<a class="leftMenu" href="club-benefits-modi.pdf"><font color="black">Club Member Benefits</a><br/>
<br>
<a class="leftMenu" href="index1.php"><font color="#ff0000">High Lapse Ratio Club Agents</a><br/>
<br>
<a class="leftMenu" href="dowise.php"><font color="black">Top 50 DOs Club Member Wise</a><br/>
<br>
<a class="leftMenu" href="lexpiry.php"><font color="ff0000">Agents Licence Expiry</a><br/>
<br>
<a class="leftMenu" href="revived_stats.php"><font color="black">Revival Heros</a><br/>
</div>
<span style="position:fixed;bottom:0;left:0;width:100%;text-align:center;"><font color="#97a8ab">Best viewed in mozilla firefox<br>Post suggestions to blah(at)blah(dot)com<font/></span>
</body>
</html>


########################################################################### ##


Here club.php...

<html>
<head>
<meta http-equiv='Content-Language' content='en-us'>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<title>Club Member Analysis</title>
</head>
<html>
<body>
<body bgcolor="#e1daca">
<?php
include("dbconnect.php");
$pycm = date('Ym', strtotime(" -5 year"));

if(!empty($_GET['agnt'])){
$agnt=$_GET['agnt'];
}else{echo "Enter agents code!";}

$query5=mysql_query("select * from club where agnt='$agnt' and fin_year='20112012'");
while ($row=mysql_fetch_array($query5)){ $net20112012=$row[3]; $nof20112012=$row[5]; $lap20112012=$row[4]; $ren20112012=$row[7]; $fyp20112012=$row[6]; $clb20112012=$row[1];}

$query4=mysql_query("select * from club where agnt='$agnt' and fin_year='20102011'");
while ($row=mysql_fetch_array($query4)){ $net20102011=$row[3]; $nof20102011=$row[5]; $lap20102011=$row[4]; $ren20102011=$row[7]; $fyp20102011=$row[6]; $clb20102011=$row[1];}

$query3=mysql_query("select * from club where agnt='$agnt' and fin_year='20092010'");
while ($row=mysql_fetch_array($query3)){ $net20092010=$row[3]; $nof20092010=$row[5]; $lap20092010=$row[4]; $ren20092010=$row[7]; $fyp20092010=$row[6]; $clb20092010=$row[1];}

$query2=mysql_query("select * from club where agnt='$agnt' and fin_year='20082009'");
while ($row=mysql_fetch_array($query2)){ $net20082009=$row[3]; $nof20082009=$row[5]; $lap20082009=$row[4]; $ren20082009=$row[7]; $fyp20082009=$row[6]; $clb20082009=$row[1];}

$query1=mysql_query("select * from club where agnt='$agnt' and fin_year='20072008'");
while ($row=mysql_fetch_array($query1)){ $net20072008=$row[3]; $nof20072008=$row[5]; $lap20072008=$row[4]; $ren20072008=$row[7]; $fyp20072008=$row[6]; $clb20072008=$row[1];}

$query21=mysql_query("select stat from policy_master where agnt='$agnt' and stat in (21,32,33)");
while ($row=mysql_fetch_array($query21)){ if($row[0]>0){$stat21++;}}

$query22=mysql_query("select agnt,plcy,dtoc,plan,fupm,stat from policy_master where agnt='$agnt' and stat='21' and fupm<='201209' and plan in (091,128,160,174,179,184,185)");
while ($row=mysql_fetch_array($query22)){$autocoverpols++;
#$docyymm=substr($row[2],0,6);
#$fup=substr($row[4],0,6);
#$diff=$fup-$docyymm;
#if($diff>200){$autocoverpols++;}
}

$query13=mysql_query("select agnt,stat,shnm,dtoc,dobt from policy_master where agnt='$agnt' and stat in (21,32,33) group by agnt,shnm,dtoc,dobt");
while ($row=mysql_fetch_array($query13)){ if($row[0]>0){$livesinfrce++;}}

$netlivesinfrce=$livesinfrce-$autocoverpols;

$query6=mysql_query("select plcy,shnm,dtoc,prem,m0de,fupm,stat from policy_master where agnt='$agnt' and stat not in (11,12,33,72,82,84) and dtoc between '20110401' and '20120331'");
while ($row=mysql_fetch_array($query6)){
$fupyy=substr($row[5],0,6);
//$fupym=substr($row[5],4,2);
$dtocy=substr($row[2],0,6);
//$dtocm=substr($row[2],4,2);
//$fup=$fupyy*12+$fupym;
//$doc=$dtocy*12+$dtocm;
//$fu=$fup-$doc;
$fu=$fupyy-$dtocy;
if($fu<100 && $fupyy<=201209){$stat41++;}
}


$query36=mysql_query("select plcy,shnm,dtoc,prem,m0de,fupm,stat from policy_master where agnt='$agnt' and stat not in (11,12,33,72,82,84) and dtoc between '20110401' and '20120331' group by agnt,shnm,dtoc,dobt");
while ($row=mysql_fetch_array($query36)){
$fupyy=substr($row[5],0,6);
//$fupym=substr($row[5],4,2);
$dtocy=substr($row[2],0,6);
//$dtocm=substr($row[2],4,2);
//$fup=$fupyy*12+$fupym;
//$doc=$dtocy*12+$dtocm;
//$fu=$fup-$doc;
$fu=$fupyy-$dtocy;
if($fu<100 && $fupyy<=201209){$netstat41++;}
}

$pycm = date('Ym', strtotime(" -5 year"));
$query7=mysql_query("select plcy,name,dtoc,prem,m0de,fupm,stat from policy_master where agnt='$agnt' and stat in (31,41) and fupm > '$pycm'");
while ($row=mysql_fetch_array($query7)){if($row[6]!=21 && $row[6]!=33) {$stat31++;}
}


$query24=mysql_query("select plcy,name,dtoc,prem,m0de,fupm,stat from policy_master where agnt='$agnt' and stat in (31,41) and fupm between '201104' and '201209'");
while ($row=mysql_fetch_array($query24)){$twoyearslapse++;}

$query8=mysql_query("select dev_officer, address_name, br_name,club_code,curr_year_first_comm, curr_fyear_first_comm, curr_year_syear_comm, curr_year_renwl_comm,branch_code,curr_year_bonus_comm from agmast where agnt='$agnt'");
while ($row=mysql_fetch_array($query8)){ $dev=$row[0]; $name=$row[1]; $brnm=$row[2]; $club=$row[3]; $fp=$row[4]; $fpf=$row[5]; $ren=$row[7]; $sub=$row[6]; $brcd=$row[8]; $bonus=$row[9];}
$fyrp=$fp+$fpf+$bonus;
$rencom=$sub+$ren;

$cmfyc=($fyrp-20000000)/100;
$cmrc=($rencom-20000000)/100;
if($fyrp>=100000){$netcom=$cmfyc+$cmrc;}else{$netcom="fyc short";}
if($netcmcom<0){$netcom=0;}

$zmfyc=($fyrp-14000000)/100;
$zmrc=($rencom-14000000)/100;
//if($fyrp>=100000){$netcomcom=$cmfyc+$cmrc}else{$netcom="fyc short"};
//if($netcmcom<0){$netcom=0};

$dmfyc=($fyrp-6000000)/100;
$dmrc=($rencom-9000000)/100;
//if($fyrp>=100000){$netcomcom=$cmfyc+$cmrc}else{$netcom="fyc short"};
//if($netcmcom<0){$netcom=0};

$bmfyc=($fyrp-3500000)/100;
$bmrc=($rencom-5000000)/100;
//if($fyrp>=100000){$netcomcom=$cmfyc+$cmrc}else{$netcom="fyc short"};
//if($netcmcom<0){$netcom=0};




if($club==1){$clb='BM Club';}
if($club==2){$clb='DM Club';}
if($club==3){$clb='ZM Club';}
if($club==4){$clb='CM Club';}
if($club==9){$clb='Dstgd Club';}

$query9=mysql_query("select stat from policy_master where agnt='$agnt' and dtoc between '20120401' and '20130331' and stat not in (11,12,84)");
while ($row=mysql_fetch_array($query9)){ if($row[0]>0){$stat++;}}

$query23=mysql_query("select stat from policy_master where agnt='$agnt' and dtoc between '20110401' and '20120331' and stat not in (11,12,84)");
while ($row=mysql_fetch_array($query23)){ if($row[0]>0){$prevpols++;}}
$lratio = round($stat41/$prevpols*100,2);
#$cmlives=130-$stat

$query10=mysql_query("select agnt,stat,shnm,dtoc,dobt from policy_master where agnt='$agnt' and dtoc between '20120401' and '20130331' and stat not in (11,12,84) group by agnt,shnm,dtoc,dobt");
while ($row=mysql_fetch_array($query10)){ if($row[0]>0){$life++;}}

$cmlives=$life-130;
$zmlives=$life-100;
$dmlives=$life- 80;
$bmlives=$life- 50;

$query11=mysql_query("create temporary table y (select agnt,shnm,dtoc,dobt,count(*) as dup from policy_master where agnt='$agnt' and dtoc between '20120401' and '20130331' and stat not in (11,12,84) group by agnt,dtoc,shnm,dobt having dup >1)");

$query12=mysql_query("select a.agnt,a.shnm,a.dtoc,a.dobt from y, policy_master as a where y.agnt = a.agnt and y.shnm = a.shnm and y.dtoc = a.dtoc and y.dobt = a.dobt and a.dtoc between 20120401 and 20130331 and stat not in (11,12,84)");
while ($row=mysql_fetch_array($query12)){ if($row[0]>0){$dup++;}}

$netpol=$life-$netstat41



?>

<div style="width:99%; position:fixed; height:17%; margin-top:-7; background-color:#363e47; color:#FFF; text-align:centre;">
<p style="position: absolute ; top: 0; text-align: left><font face="geneva" size='1' color="#ffffff" ><a href="clubagents.php" ><font color="ffffff">Home</font></p></a>
<p align='center'><font face="geneva" size='5' color="#ffffff" ><b>C L U B &nbsp M E M B E R &nbsp A N A L Y S I S</font></p>

<table border='1' bgcolor="#ffffff" width='60%' cellpadding="0" cellspacing="0" align='center' id='table1'>

<tr>
<td><font color=brown size=3><b><?php echo trim($name); ?> </td>
<td align='center'><font color=blue size=3><b><a href="agprofile.php?ag=<?php echo $agnt; ?>"><?php echo $agnt; ?></td>
<td><font color=blue size=3><b><?php
if($clb==""){echo "No Club";}else{echo $clb;}?></td>
<td><font color=blue size=3><b><font color=brown size=2> <?php echo "DO Code: $dev"; ?> </td>
<td><font color=blue size=3><b> &nbsp <?php echo $brcd; ?></td>

</tr>

</table>

</div>

<div style="width:60%; height:100%; float:left; margin-top:10%;">


<table border='1' cellpadding="0" cellspacing="0" bgcolor="#66cccc" width='99.2%' id='table2'>

<tr>

<td><font color="#ff0060">

<p align='center'><b>Financial Year</b></td>

<td><font color="#ff0060">

<p align='center'><b>Club</b></td>

<td><font color="#ff0060">

<p align='center'><b>Net Lives</b></td>

<td><font color="#ff0060">

<p align='center'><b>Cum Inforce Lives</b></td>

<td><font color="#ff0060">

<p align='center'><b>Lapse Ratio</b></td>

<td colspan='2'><font size=3 color=blue>

<table border='0' width='100%' id='table3'>

<tr>

<td colspan='2'><font color="#ff0060">

<p align='center'><b>Commission Paid</b></td>

</tr>

<tr>

<td><font color="#ff0060">

<p align='center'><b>Renewal</b></td>

<td><font size=2 color="#ff0060">

<p align='center'><b>First Year</b></td>

</tr>

</table>

</td>

</tr>

<tr>

<td><font size=2 color=blue>

<p align='center'><b>2011-2012</b></td>

<td ><font size=3 color=black>

<p align='center'><?php echo $clb20112012; ?></td>

<td ><font size=3 color=black>

<p align='center'><?php echo $net20112012; ?></td>

<td><font size=3 color=black>

<p align='center'><?php echo $nof20112012; ?></td>

<td><font size=3 color=black>

<p align='center'><?php echo $lap20112012; ?></td>

<td><font size=3 color=black>

<p align='center'><?php echo $ren20112012; ?></td>

<td><font size=3 color=black>

<p align='center'><?php echo $fyp20112012; ?></td>

</tr>

<tr>

<td height="19"><font size=2 color=blue>

<p align='center'><b>2010-2011</b></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $clb20102011; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $net20102011; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $nof20102011; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $lap20102011; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $ren20102011; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $fyp20102011; ?></td>

</tr>

<tr>

<td height="19"><font size=2 color=blue>

<p align='center'><b>2009-2010</b></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $clb20092010; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $net20092010; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $nof20092010; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $lap20092010; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $ren20092010; ?></td>

<td height="19"><font size=3 color=black>

<p align='center'><?php echo $fyp20092010; ?></td>

</tr>

</table>



<table border='1' cellpadding="0" cellspacing="0" bgcolor="#b5b6b5" style="float:left; margin-top:1.1em;" width='50%' id='table5'>

<tr>

<td colspan='3'>

<p align='center'><font color="#ff0099"><b>CM CLUB Eligibility Criteria</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Number of Lives</td>

<tr>

<td width='4%'>

<p align='center'>Net Lives / No.of lives Inforce</td>

<td width='4%'>

<p align='center'>130 / 600 </td>

</tr>

<tr>

<td rowspan='2' width='8%'>Commission</td>

<td width='4%'>

<p align='center'>First Year</td>

<td width='4%'>

<p align='center'>2,00,000</td>

</tr>

<tr>

<td width='4'>

<p align='center'>Renewal</td>

<td width='4%'>

<p align='center'>2,00,000</td>



</tr>

</table>

<table border='1' cellpadding="0" cellspacing="0" bgcolor="#66ffcc" style="float:right; margin-top:1.1em; margin-right:0.3em;" width='48%' id='table5'>

<tr>

<td colspan='3'>

<p align='center'><font color="#ff0099"><b>ZM CLUB Eligibility Criteria</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Number of Lives</td>

<tr>

<td width='4%'>

<p align='center'>Net Lives / No.of lives Inforce</td>

<td width='4%'>

<p align='center'>100 / 400</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Commission</td>

<td width='4%'>

<p align='center'>First Year</td>

<td width='4%'>

<p align='center'>1,40,000</td>

</tr>

<tr>

<td width='4'>

<p align='center'>Renewal</td>

<td width='4%'>

<p align='center'>1,40,000</td>

</tr>

</table>

<table border='1' cellpadding="0" cellspacing="0" bgcolor="#66ffcc" style="float:left;clear:both; margin-top:1.2em;" width='50%' id='table5'>

<tr>

<td colspan='3'>

<p align='center'><font color="#ff0099"><b>DM CLUB Eligibility Criteria</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Number of Lives</td>

</tr>

<tr>

<td width='4%'>

<p align='center'>Net Lives / No.of lives Inforce</td>

<td width='4%'>

<p align='center'>80 / 250</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Commission</td>

<td width='4%'>

<p align='center'>First Year</td>

<td width='4%'>

<p align='center'>60,000</td>

</tr>

<tr>

<td width='4'>

<p align='center'>Renewal</td>

<td width='4%'>

<p align='center'>90,000</td>

</tr>

</table>

<table border='1' cellpadding="0" cellspacing="0" bgcolor="#b5b6b5" style="float:right; margin-top:1.2em; margin-right:0.3em;;" width='48%' id='table5'>

<tr>

<td colspan='3'>

<p align='center'><font color="#ff0099"><b>BM CLUB Eligibility Criteria</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Number of Lives</td>

</tr>

<tr>

<td width='4%'>

<p align='center'>Net Lives / No.of lives Inforce</td>

<td width='4%'>

<p align='center'>50 / 150</td>

</tr>

<tr>

<td rowspan='2' width='8%'>Commission</td>

<td width='4%'>

<p align='center'>First Year</td>

<td width='4%'>

<p align='center'>35,000</td>

</tr>

<tr>

<td width='4'>

<p align='center'>Renewal</td>

<td width='4%'>

<p align='center'>50,000</td>

</tr>

</table>











</div>



<div style="width:39%; height:100%; float:left; margin-top:8%; margin-left:0.1em;">

<table border='1' cellpadding="0" cellspacing="0" bgcolor="#33ffff" style="margin-top:1.2em" width='100%' id='table4' align=center >

<tr>

<td colspan='6' align='center'>
<p align='center'><font color="#ff0099" size=4><b>2012-2013</b><br>
<font color="#ff3300" size=2>(Click on the under lined numbers to get details)</td>

</tr>





<tr>

<td width='35%' align='center'><font color=black>

<p align='left'>Policies introduced this year</td>


<td width='9%' align='center'><font color=black size=3px>

<p align='center'><b><a href="curryrlist.php?ag=<?php echo $agnt; ?>"><?php echo $stat; ?></b></a></td>

<b>

<td width='9%' align='center'><font color=black>

<p align='left'>Number of Lives</td>

<td width='5%' align='center'><font color=black size=3px>

<p align='center'><?php echo $life; ?></td>

</tr>



<tr>

<td width='35%' align='center'><font color=black>

<p align='left'>Number of Duplicates</td>

<td width='9%' align='center'><font color=black size=3px>

<p align='center'><b><a href="duplist.php?ag=<?php echo $agnt; ?>"><?php

if($dup==""){echo "0";}else{echo $dup;}?></b></a></td>

<b>



<td width='9%' align='center'><font color=black>

<p align='left'>Net Lives for this Year</td>

<td width='22%' align='center'><font color=black size=3px>

<p align='center'><?php echo $netpol; ?></td>

</tr>


<tr>

<td width='35%' align='center'><font color=black>

<p align='left'>Number of Lives Inforce( approx )</td>

<td width='9%' align='center' colspan=1><font color=black size=3px>

<p align='center'><?php echo $netlivesinfrce; ?>

<b>

<td colspan='4' align='center'><font color=black>

<p align='center' ><font color="#ff0099"><b>Commission</b></font></td>

</tr>

<tr>

<td width='35%' align='center'><font color=black>

<p align='left'>First Year Lapse Policies for 2011-2012</td>

<td width='5%' align='center'><font color="#ff0099" size=3px><b>

<p align='center'><b><a href="stat41list.php?ag=<?php echo $agnt; ?>"><?php

if($stat41==""){echo "0";}else{echo $stat41;}?></b></a></td>
<b>

<td width='19%' align='center'><font color=black>

<p align='left'>Renewal</td>

<td width='5%' align='center' colspan=3><font color=black size=3px>

<p align='center'><?php echo number_format($rencom/100,0); ?></td>

</tr>

<tr>

<td width='35%' align='center'><font color=black>

<p align='left'>Policies which can be revived</td>

<td width='5%' align='center'><font color=green size=3px><b>

<p align='center'><b><a href="revivallist.php?ag=<?php echo $agnt; ?>"><?php echo $stat31; ?></b></a></td>

<b>

<td width='19%' align='center'><font color=black>

<p align='left'>First Year + Bonus</td>

<td width='5%' align='center' colspan=3><font color=black size=3px>

<p align='center'><?php echo number_format($fyrp/100,0); ?></td>

</tr>

<tr>

<td width='35%' align='center'><font color=black>

<p align='left'><img src="img/new04.gif">Policies Last Year (2011-2012) </td>

<td width='5%' align='center'><font color=green size=3px><b>
<p align='center'><b><a href="prevpols.php?ag=<?php echo $agnt; ?>"><?php echo $prevpols; ?></b></a></td>

<b>

<td width='19%' align='center'><font color=black>

<p align='left'><img src="img/new04.gif"><br>Lapse Ratio </td>

<td width='5%' align='center' colspan=3><font color=green size=6px>

<p align='center'>
<?php
if($lratio>14){
echo "<b><font color=red size=5px><img align=middle src=img/nextArrow.gif height=35 width=40>$lratio</b>";
}
else if($lratio==0){
echo "<b><font color=blue size=5px><img align=left src=img/smily.gif height=35 width=35 >$lratio</b>";
}
else
{
echo "<b>$lratio</b>";
}
?>
</td>

</tr>

<tr>

<td width='35%' height='45' align='center'><font color=black>

<p align='left'><img src="img/new04.gif">Autocover Pols</td>

<td width='5%' align='center'><font color=green size=3px><b>
<p align='center'><b><a href="autocoverpols.php?ag=<?php echo $agnt; ?>"><?php echo $autocoverpols; ?></b></a></td>

<b>

<td width='19%' align='center'>~~~~<``<font color=black>

<p align='left'> </td>

<td width='5%' align='center' colspan=3><font color=black size=3px>

<p align='center'><?php ; ?></td>

</tr>
<tr>

<td height='45' colspan='6' align='center'>
<p align='center'><font color=black> Over all policies lapsed between 042011 to 092012 :&nbsp <a href="twoyearslapse.php?ag=<? echo $agnt; ?>"><? echo "<b>$twoyearslapse</b>"; ?></a></td>

</tr>



</table>

</div>

Thanking you.
Re: validation of a text box input... [message #180802 is a reply to message #180784] Tue, 19 March 2013 16:13 Go to previous message
Salvatore is currently offline  Salvatore
Messages: 38
Registered: September 2012
Karma: 0
Member
On 2013-03-18, nag <visitnag(at)gmail(dot)com> wrote:
> [snip]
>
> Thanking you.

I see several problems:

1. You aren't stopping anything from happening when the $_GET['agnt']
superglobal is empty. All your script does is echo out an error message:

> if(!empty($_GET['agnt'])){
> $agnt=$_GET['agnt'];
> }else{echo "Enter agents code!";}

2. The "$agnt" variable isn't declared in the right scope. PHP will
probably handle this for you and will only issue you a warning, but you
shouldn't keep the declaration of $agnt in the top of club.php.

3. In your <form> tag, you are setting the action to
"club.php?agnt=$agnt", and your request method is set to "GET". Instead
of forcefully setting the "agnt" request variable in the <form> tag, you
should set it in its respective <input> tag.

--
Blah blah bleh...
GCS/CM d(-)@>-- s+:- !a C++$ UBL++++$ L+$ W+++$ w M++ Y++ b++
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: php curl only saves a cookie with tempnam()
Next Topic: Test Message
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 11:49:14 GMT 2024

Total time taken to generate the page: 0.04817 seconds