/    Sign up×
Community /Pin to ProfileBookmark

Hi,
I’ve got a problem. I have a form which asks the user to login if successful it will go to my filteringview.php. In this page the filterOnload is included. My filterOnload contains a 2 listbox. The first listbox displays No Record if there’s no record found in the database. The 2nd listbox displays the records found in the database for a certain month.

[code=php]
function VwRc_onchange() {
var tempVwRcValue = document.ViewForm.VwRc.value;
document.ViewForm.passActId.value = extract_val(tempVwRcValue,1);
document.ViewForm.passActDate.value = extract_val(tempVwRcValue,2);
document.ViewForm.passPIN.value = extract_val(tempVwRcValue,3);
document.ViewForm.passPrjCode.value = extract_val(tempVwRcValue,4);

}

function extract_val(str,item)
{
var src,strval,xstr;
xstr = str+”,xxx,”;
for(a=1;a<=item;a++)
{
iPos = xstr.search(“,”);
strval = xstr.substr(0,iPos);
xstr = xstr.substr(iPos+1);
}
return strval;
}

<?//connect to database code here

$QueryString=”SELECT * FROM StatusTable INNER JOIN StaffTable ON StatusTable.PIN = StaffTable.PIN WHERE StaffTable.PinProfile = ‘”.$_SESSION[‘username’].”‘ and StatusTable.ActDate >= ‘”.$DateFirst.”‘ and StatusTable.ActDate <= ‘”.$DateEnd.”‘ ORDER BY StatusTable.ActDate DESC”;

$rs=mysql_query($QueryString);

$rsTable=mysql_num_rows($rs);

if (($rsTable==0))
{
?>

<p><select class=select size=”10″ name=”VwRc” style=”width: 780; height: 50; FONT-FAMILY: Lucida Console, Courier New; FONT-SIZE: x-small;” LANGUAGE=javascript onchange=”return VwRc_onchange()”>
<option value = “No Record”>No Record(s) Found</option>
</select>

<p><font size=4 color=navy><? print “Filtered Records from: “;?><? print $DateFirst;?><? print ” to “;?><? print $DateEnd;?></font></p>
<? }
else
{
function AppendSpace($sString,$iMaxChar)
{
extract($GLOBALS);

$sSpace=””;
for ($i=1; $i<=($iMaxChar-strlen($sString)); $i=$i+1)
{
$sSpace=$sSpace.”&nbsp;”;
}

$AppendSpace=$sString.$sSpace;
return $function_ret;
} ?>

<p><select class=select size=”120″ name=”VwRc” style=”width: 780; height: 250; FONT-FAMILY: Lucida Console, Courier New; FONT-SIZE: x-small;” LANGUAGE=javascript onchange=”return VwRc_onchange()”>
<? while(!($rsTable==0))
{ $rsTable=mysql_fetch_array($rs);

<option value=”<? echo $rsTable[‘ActId’]; ?>,<? echo $rsFilter[“ActDate”]; ?>,=”<? echo $rsTable[‘PrjCode’]; ?> “>
<? echo AppendSpace($rsFilter[“ActId”],14); ?>&nbsp;<? echo AppendSpace($rsFilter[“ActDate”],18); ?>?>&nbsp;<? echo AppendSpace($rsFilter[“PrjCode”],18); ?>
</option>

}
?>
</select>
<p><font size=4 color=navy><? print “Filtered Records from: “;?><? print $DateFirst;?><? print ” to “;?><? print $DateEnd;?></font></p>
<? } ?>
[/code]

If there’s no record it displays the 1st listbox or No Record in a listbox but I tried to put data in my database but it did not display the data. I really am having problem here. Hope someone could help me with my code. ?

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @franches 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...