•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,575 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,596 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1238 | Replies: 1
![]() |
•
•
Join Date: Oct 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi Friends,
since i am new to this script, I need your help, well this is my problem, i need to compare userdate with my backend date. for that i have used a dynamic dropdown combo as an id and i need to fetch the date associated with that id and need to compare with the user date in a hidden format. once the user press the calculate button it has to compare the user date and the hidden backend date and it has to display some values based on some condition.. this is the task. well i am displaying the coding also. Thank you friends.
<?php
$con=mysql_connect("localhost","root","");
if(!con)
{
die("could not connect to the database".mysql_error());
}
$db=mysql_select_db("srijesh",$con);
echo "connection succed";
$qry="select DISTINCT C from sheet1 ORDER BY C";
$result=mysql_query($qry);
?>
<html>
<head>
<title> service calculator </title>
<script type="javascript">
function fnsubmit()
{
window.document.f1.method="post";
window.document.f1.submit();
}
</script>
</head>
<body bgcolor="pale red">
<form name="f1" method="post" action="1.php">
<h1>Date comparing</h1>
<hr>
<center><p>Taxable Service:</td><td><select name="taxservice" onChange="fnsubmit()">
<option value=""></option>
<?php
while($row=mysql_fetch_array($result))
{
if($_POST['taxservice']== $row['C'])
{
$selected = 'selected';
}
else
{
$selected = '';
}
echo $selected;
echo "<option value='".$row['C']."' $selected;>.$row['C']."</option>";
}
?>
</select></p>
<p>user date:<input type="text" name="userdt" value=""></p>
<p>date compare:<input type="button" name="dtcompare" value="datecompare"> </p>
<p>ess:<input type="text" name="ess" value=""> </p>
<p>total:<input type="text" name="tot" value=""> </p>
</center> </form></body></html>
since i am new to this script, I need your help, well this is my problem, i need to compare userdate with my backend date. for that i have used a dynamic dropdown combo as an id and i need to fetch the date associated with that id and need to compare with the user date in a hidden format. once the user press the calculate button it has to compare the user date and the hidden backend date and it has to display some values based on some condition.. this is the task. well i am displaying the coding also. Thank you friends.
<?php
$con=mysql_connect("localhost","root","");
if(!con)
{
die("could not connect to the database".mysql_error());
}
$db=mysql_select_db("srijesh",$con);
echo "connection succed";
$qry="select DISTINCT C from sheet1 ORDER BY C";
$result=mysql_query($qry);
?>
<html>
<head>
<title> service calculator </title>
<script type="javascript">
function fnsubmit()
{
window.document.f1.method="post";
window.document.f1.submit();
}
</script>
</head>
<body bgcolor="pale red">
<form name="f1" method="post" action="1.php">
<h1>Date comparing</h1>
<hr>
<center><p>Taxable Service:</td><td><select name="taxservice" onChange="fnsubmit()">
<option value=""></option>
<?php
while($row=mysql_fetch_array($result))
{
if($_POST['taxservice']== $row['C'])
{
$selected = 'selected';
}
else
{
$selected = '';
}
echo $selected;
echo "<option value='".$row['C']."' $selected;>.$row['C']."</option>";
}
?>
</select></p>
<p>user date:<input type="text" name="userdt" value=""></p>
<p>date compare:<input type="button" name="dtcompare" value="datecompare"> </p>
<p>ess:<input type="text" name="ess" value=""> </p>
<p>total:<input type="text" name="tot" value=""> </p>
</center> </form></body></html>
Honestly. I'd use xmlhttp (Ajax) and do it on the server. If you *need* it to be hidden from the user, then COMPLETELY hide it from the user by removing it from the page. Just have ONCHANGE call an xmlhttp function with only the apropriate user/date, and your php page on the server does the comparison and just hands you back the appropriate values.
Need a simple, powerful knowledgebase? Bigattichouse Knowledge Base finds the solution while you're still typing the problem.
http://www.bigattichouse.com/knowledgebase.html
http://www.bigattichouse.com/knowledgebase.html
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Affiliate Commerce System And Method (Promotion and Marketing Plans)
- Dynamic dropdown list (ASP.NET)
- Storing dynamic form values in Arrays for display & insert (PHP)
- IPB vs. phpBB (Growing an Online Community)
- Dropdown box in Python (Python)
- Help with dynamic menu (HTML and CSS)
Other Threads in the PHP Forum
- Previous Thread: Gd
- Next Thread: Can PHP talk to a VB msmdb?


Linear Mode