473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

change color of text box when value entered into text box

1
Hello

Actually I am working on php I have created a insertion form in which I need when entering a value into bill amt text box then it should be compare with exp value if it is not equal then the color of bill amt text box should be change.

here is code
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. error_reporting(E_ALL^E_NOTICE);
  3. $dbhost = "localhost";
  4. $dbuser = "root";
  5. $dbpass = "";
  6. $dbname = "purchase";
  7. mysql_connect($dbhost, $dbuser, $dbpass);
  8. mysql_select_db($dbname) or die(mysql_error());
  9.  
  10. $qry_result= mysql_query("SELECT NRC FROM currentnfb") or die(mysql_error());
  11. $row=mysql_fetch_array($qry_result);
  12. $num=$row[NRC];
  13.  
  14. $description=$_POST['description'];
  15. $number=$_POST['number'];
  16. $text1=$_POST['text1'];
  17. $year1=$_POST['year1'];
  18. $text=$_POST['text'];
  19. $fileno=$number. '-' .$text1. '/' .$year1. '/' .$text;
  20. $Nameoffirm=$_POST['Nameoffirm'];
  21. $exp=$_POST['exp'];
  22. $year6=$_POST['year6'];
  23. $month6=$_POST['month6'];
  24. $day6=$_POST['day6'];
  25. $dateofsanction=$year6. '-' .$month6. '-' .$day6;
  26. $year5=$_POST['year5'];
  27. $month5=$_POST['month5'];
  28. $day5=$_POST['day5'];
  29. $dateofpo=$year5. '-' .$month5. '-' .$day5;
  30. $indentno=$_POST['indentno'];
  31. $year=$_POST['year'];
  32. $month=$_POST['month'];
  33. $day=$_POST['day'];
  34. $dateofindent=$year. '-' .$month. '-' .$day;
  35. $billno=$_POST['billno'];
  36. $year4=$_POST['year4'];
  37. $month4=$_POST['month4'];
  38. $day4=$_POST['day4'];
  39. $dateofbillno=$year4. '-' .$month4. '-' .$day4;
  40. $BLno=$_POST['BLno'];
  41. $billpass=$_POST['billpass'];
  42. $billamt=$_POST['billamt'];
  43. if($billamt=$exp)
  44. {
  45. billamt.style.background='green';}
  46. else
  47. {
  48. billamt.style.background='red';}
  49. $year3=$_POST['year3'];
  50. $month1=$_POST['month1'];
  51. $day1=$_POST['day1'];
  52. $dateofbill=$year3. '-' .$month1. '-' .$day1;
  53. $availbal=$_POST['availbal'];
  54. $progbal=$_POST['progbal'];
  55. $remark=$_POST['remark'];
  56. $availbal=$num;
  57. $progbal=$num-$exp;
  58.  
  59.  
  60.  
  61.  
  62. $query="insert into nfone(description,fileno,Nameoffirm,exp,dateofsanction,dateofpo,indentno,dateofindent,billno,dateofbillno,BLno,billpass,billamt,dateofbill,availbal,progbal,remark) values ('$description','$fileno','$Nameoffirm','$exp','$dateofsanction','$dateofpo','$indentno','$dateofindent','$billno','$dateofbillno','$BLno','$billpass','$billamt','$dateofbill','$availbal','$progbal','$remark')";
  63. mysql_query($query)or die('error');
  64. echo"database update with:" .$expend."".$availbal."".$progbal."".$billamt."";
  65. $NRC=$progbal;
  66. $sql = "UPDATE currentnfb
  67.        SET NRC = '$progbal'";
  68.        $retval = mysql_query( $sql);
  69. if(! $retval )
  70. {
  71.   die('Could not update data: ' . mysql_error());
  72. }
  73. echo "Updated data successfully\n";
  74.  
  75. ?>
  76.  
Apr 10 '13 #1
1 1415
johny10151981
1,059 1GB
how about onchange='this.style.color="newColor"'?
Apr 10 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Leif Wessman | last post by:
I'm using a bundled version of GD: 2.0.23 compatible. When using the function imagettftext() with a negative color to get a aliased text, the text gets grainy. What could be wrong? I've tried...
1
by: Glen Welsh via AccessMonster.com | last post by:
I am trying to set a control to equal the last value entered for that control on the previous form. In other words: I have a control called HullNumber, which will remain constant for approximately...
1
by: David Smith | last post by:
What I want to be able to do: A textbox is available that the user can enter information into. Specifically (for the purposes of this post), the user is asked to enter a number, and that number...
1
by: Robert Halstead | last post by:
Hi guys, I am copying text from Microsoft Word 2003 into a asp.net text box then writing the textbox to a file. My problem is, when I go to display the file using regular asp, it get all these...
3
by: ASP Developer | last post by:
I have a variety of pages that use a master page. For some reason when I attempt to copy any of the label text on the screen it seems to highlight most of the screen randomly and I can't simply...
0
by: tenko | last post by:
here's a question regarding changing units, say from g to kg without changing the entire codes.... my mathematical equation uses KG (kilograms), but the user can choose whether to enter values in...
1
by: cmgmyr | last post by:
Hello, I have an application that I'm building but I'm getting stuck on a few things. 1. I have a slider to select how many "sections" to have, this will then build a table of text boxes for a...
13
by: sarega | last post by:
Hi, Here am trying to populate the page with new url, with the value that is being entered in the text box. this is the php code called example.php <? echo "<input type='text' name='text1'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.