capturing the javascript calculations in a mysql database PHP

Hi all of you I have this application am making and its suppesd to make claims of refund, part of the script is here But I cannot save this data into all the database /*****************************************************************************************************************************/ function getValues(val){ var numVal1=parseInt(document.getElementById("milleage_start").value); var numVal2=parseInt(document.getElementById("milleage_finish").value); var numVal3=parseInt(document.getElementById("amount").value); var rate = 35.00; var totalValue = numVal1 - numVal2; var totalAmount = totalValue * rate; document.getElementById("milleage").value = totalValue; document.getElementById("amount").value = totalAmount; } /*****************************************************************************************************************************/ <td><div align="right">Finish</div></td> <td><input type="text" name="textfield9" id="milleage_start" class="required" onkeyup="getValues(1)"/></td> </tr> <tr> <td><div align="right">Start </div></td> <td><input type="text" name="textfield10" id="milleage_finish" class="required" onkeyup="getValues(2)" /></td> </tr> <tr> <td td bgcolor="#E0E0E0"><div align="left"><strong>Total Milleage (KM) </strong></div></td> <td td bgcolor="#E0E0E0"><strong> <input type="text" name="milleage" id="milleage" onkeyup="getValues(3)" class="required" values=""/> <input type="hidden" name="milleage" id="milleage" /> </strong></td> </tr> <tr> <td><div align="right">Amount in KShs </div></td> <td><strong> <input type="text" name="amount" id="amount" class="required" values="" /> <input type="hidden" name="amount" id="amount" /> (Rate @ Kshs 35)</strong></td> Any idea and help will be most appreceated

@Calvin, I have a question for you. Why use a database? (Also, I dont see any declaration to accessing the Db connection or do things work differently in php world ) This was a decision I had to make in my learning process and am now working with XML which can also store organized portable data creating a lite system. You can also use the data later to work on different systems. Me hobbyist thots.. :-)

@Calvin is right, unless you are planning to expand your website (user membership, ordering system, etc.), then database connection is not needed. XML, JSON or a simpe TXT file should do. And indeed, there are no database connection in the script you have posted. From what I have seen your script is just displaying the result in a specific DIV element. If you want to save result in database or create a raw file, either you do it asynchronously (with some JS and AJAX call) or need to have a button or something to valid result and call a new page. On Fri, Dec 4, 2009 at 10:56 AM, aki <aki275@googlemail.com> wrote:
@Calvin,
I have a question for you. Why use a database? (Also, I dont see any declaration to accessing the Db connection or do things work differently in php world )
This was a decision I had to make in my learning process and am now working with XML which can also store organized portable data creating a lite system. You can also use the data later to work on different systems.
Me hobbyist thots.. :-)
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay Thanks again so much for your response On Fri, Dec 4, 2009 at 10:56 AM, aki <aki275@googlemail.com> wrote:
@Calvin,
I have a question for you. Why use a database? (Also, I dont see any declaration to accessing the Db connection or do things work differently in php world )
This was a decision I had to make in my learning process and am now working with XML which can also store organized portable data creating a lite system. You can also use the data later to work on different systems.
Me hobbyist thots.. :-)
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

Thanks for your suggestion, am told there is a way you can create duplicate hidden fields then pass the fields to the insert into table name and you will get the calculated values into teh database I have tried it to no avail, I am going to try the above xml, jquery I works, nway that is just part of a system am developing, and a db is very necessary On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
On Fri, Dec 4, 2009 at 10:56 AM, aki <aki275@googlemail.com> wrote:
@Calvin,
I have a question for you. Why use a database? (Also, I dont see any declaration to accessing the Db connection or do things work differently in php world )
This was a decision I had to make in my learning process and am now working with XML which can also store organized portable data creating a lite system. You can also use the data later to work on different systems.
Me hobbyist thots.. :-)
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

Have a read at: http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-... On Fri, Dec 4, 2009 at 11:14 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Thanks for your suggestion, am told there is a way you can create duplicate hidden fields then pass the fields to the insert into table name and you will get the calculated values into teh database I have tried it to no avail,
I am going to try the above xml, jquery I works, nway that is just part of a system am developing, and a db is very necessary
On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
On Fri, Dec 4, 2009 at 10:56 AM, aki <aki275@googlemail.com> wrote:
@Calvin,
I have a question for you. Why use a database? (Also, I dont see any declaration to accessing the Db connection or do things work differently in php world )
This was a decision I had to make in my learning process and am now working with XML which can also store organized portable data creating a lite system. You can also use the data later to work on different systems.
Me hobbyist thots.. :-)
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and HTHs. 3 months ago, when drawing out the workflow and code for the Mbytemeter program, I ran into issues with about saving data. I had the options of using a SQL lite Db, CSV or Excel file. The main problem I had was to store and retrieve the data in an organized manner i.e each cell to correspond with the data stored so that this data can be retrieved by calls to that cell. So for example : In Mybtemeter, it has an option to save Telco profiles. These profiles contain data : Name , APN Value, UserName, Password and DUN Number. When the program launches ( form load event ) it would populate a Drop Down Box with the stored profiles ( using a query ). Then the other issue was, how small and open was my program? Thus, I set out on XML and I think it was a good decision. I think XML is amazing. ( and the journey continues )

Aki, here's the interesting part, you can save and output XML to and from mysql! I can't think of any reason one would want to do that, but that didn't stop MySQL AB in having it in 5.1<http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html> On Fri, Dec 4, 2009 at 11:31 AM, aki <aki275@googlemail.com> wrote:
On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and HTHs. 3 months ago, when drawing out the workflow and code for the Mbytemeter program, I ran into issues with about saving data. I had the options of using a SQL lite Db, CSV or Excel file. The main problem I had was to store and retrieve the data in an organized manner i.e each cell to correspond with the data stored so that this data can be retrieved by calls to that cell. So for example : In Mybtemeter, it has an option to save Telco profiles. These profiles contain data : Name , APN Value, UserName, Password and DUN Number. When the program launches ( form load event ) it would populate a Drop Down Box with the stored profiles ( using a query ). Then the other issue was, how small and open was my program? Thus, I set out on XML and I think it was a good decision. I think XML is amazing. ( and the journey continues )
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

the trick is after doing the calculations and storing the values in a input or hidden field. it will display on the user side but when u submit the values will be blank. what u need is to set the value of the field to true when submitting the form --- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com> wrote:
From: Peter Karunyu <pkarunyu@gmail.com> Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP To: "Skunkworks Forum" <skunkworks@lists.my.co.ke> Date: Friday, December 4, 2009, 10:51 AM Aki, here's the interesting part, you can save and output XML to and from mysql! I can't think of any reason one would want to do that, but that didn't stop MySQL AB in having it in 5.1
On Fri, Dec 4, 2009 at 11:31 AM, aki <aki275@googlemail.com> wrote:
On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com> wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and HTHs. 3 months ago, when drawing out the workflow and code for the Mbytemeter program, I ran into issues with about saving data. I had the options of using a SQL lite Db, CSV or Excel file. The main problem I had was to store and retrieve the data in an organized manner i.e each cell to correspond with the data stored so that this data can be retrieved by calls to that cell. So for example : In Mybtemeter, it has an option to save Telco profiles. These profiles contain data : Name , APN Value, UserName, Password and DUN Number. When the program launches ( form load event ) it would populate a Drop Down Box with the stored profiles ( using a query ). Then the other issue was, how small and open was my program? Thus, I set out on XML and I think it was a good decision. I think XML is amazing. ( and the journey continues )
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

Michael Your suggestion sounds easier I have tried having my text inputs this way but it still not working <input type="text" disabled="disabled" name="amount" id="amount" class="required" /> <input type="hidden" name="amount" id="amount" value="true"/> Can you please check it for me, Thanks so much On Fri, Dec 4, 2009 at 12:12 PM, michael nyangweso <mnyangweso@yahoo.com>wrote:
the trick is after doing the calculations and storing the values in a input or hidden field. it will display on the user side but when u submit the values will be blank. what u need is to set the value of the field to true when submitting the form
--- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com> wrote:
From: Peter Karunyu <pkarunyu@gmail.com> Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP To: "Skunkworks Forum" <skunkworks@lists.my.co.ke> Date: Friday, December 4, 2009, 10:51 AM Aki, here's the interesting part, you can save and output XML to and from mysql! I can't think of any reason one would want to do that, but that didn't stop MySQL AB in having it in 5.1
On Fri, Dec 4, 2009 at 11:31 AM, aki <aki275@googlemail.com> wrote:
On Fri, Dec 4, 2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com> wrote:
TI used javascript because that is what i know and that is just piece of the code, I have database declarations and captured the inputs of which are not entered into the database, I think the big issue is how do i capture users entering data that is bound to be calculated at a standard rate eg users to enter first milleage reading then last milleage reading , javascript or any other to get the diffrence and then multiply by the rate to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and HTHs. 3 months ago, when drawing out the workflow and code for the Mbytemeter program, I ran into issues with about saving data. I had the options of using a SQL lite Db, CSV or Excel file. The main problem I had was to store and retrieve the data in an organized manner i.e each cell to correspond with the data stored so that this data can be retrieved by calls to that cell. So for example : In Mybtemeter, it has an option to save Telco profiles. These profiles contain data : Name , APN Value, UserName, Password and DUN Number. When the program launches ( form load event ) it would populate a Drop Down Box with the stored profiles ( using a query ). Then the other issue was, how small and open was my program? Thus, I set out on XML and I think it was a good decision. I think XML is amazing. ( and the journey continues )
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

function setValue(controlName) { controlName.selected = true; } <input type="text"
disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount2" id="amount2" value="true"/>
the first mistake is that you have to input types with the same name let name the second one amount2 to assign the value do amount2.value = "assignn here the value you calculated" the create a function eg: this is where u need to set the field to true. function setValue(controlName) { controlName.selected = true; } then on submit add this onclick="setValue(amount2);" this has always worked for me ******************************************** *nix is user friendly. It's just very particular about who it's friends are. --- On Fri, 12/4/09, Calvin Omari <calvinebarongo@gmail.com> wrote:
From: Calvin Omari <calvinebarongo@gmail.com> Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP To: "Skunkworks Forum" <skunkworks@lists.my.co.ke> Date: Friday, December 4, 2009, 11:45 AM Michael Your suggestion sounds easier I have tried having my text inputs this way but it still not working <input type="text" disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount" id="amount" value="true"/>
Can you please check it for me, Thanks so much
On Fri, Dec 4, 2009 at 12:12 PM, michael nyangweso <mnyangweso@yahoo.com> wrote:
the trick is after doing the calculations and storing the values in a input or hidden field. it will display on the user side but when u submit the values will be blank. what u need is to set the value of the field to true when submitting the form
--- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com> wrote:
From: Peter Karunyu <pkarunyu@gmail.com>
Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP
To: "Skunkworks Forum" <skunkworks@lists.my.co.ke>
Date: Friday, December 4, 2009, 10:51 AM
Aki, here's the interesting part, you
can save and output XML to and from mysql!
I can't think of any reason one would want to do that,
but that didn't stop MySQL AB in having
it in 5.1
On Fri, Dec 4, 2009 at 11:31 AM,
aki <aki275@googlemail.com>
wrote:
On Fri, Dec 4,
2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>
wrote:
TI used javascript because
that is what i know and that is just piece of the code, I
have database declarations and captured the inputs of which
are not entered into the database, I think the big issue is
how do i capture users entering data that is bound to be
calculated at a standard rate eg users to enter first
milleage reading then last milleage reading , javascript or
any other to get the diffrence and then multiply by the rate
to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and
HTHs. 3 months ago, when drawing out the workflow and code
for the Mbytemeter program, I ran into issues with about
saving data. I had the options of using a SQL lite Db,
CSV or Excel file. The main problem I had was to store and
retrieve the data in an organized manner i.e each cell to
correspond with the data stored so that this data can be
retrieved by calls to that cell. So for example : In
Mybtemeter, it has an option to save Telco profiles. These
profiles contain data : Name , APN Value, UserName, Password
and DUN Number. When the program launches ( form load event
) it would populate a Drop Down Box with the stored
profiles ( using a query ). Then the other issue was, how
small and open was my program? Thus, I set out on XML and I
think it was a good decision. I think XML is amazing. ( and
the journey continues )
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

Well it seems like this a real problem among many developers. I saw it once and thought it was just a rare event but now that it has occured again I think I need to comment on it. First of all, I think understanding the concepts always comes before trying to use anything. There is NO way u can be able to access the database from your browser. Your PHP code never gets to the browser, its the results of the execution of the php scripts that goes to the browser. Anything you want to do with your database has to be provided for via some form of request sent from the browser to the sever which takes the request, processes it and then performs some operation depening on what it interpreted from the request and then send back to the browser the results of whatever was executed where the browser does something with the returned results. So as the other guys have been saying, you can do this via JSON, xml, normal http query notation (parameter=value) notation or some other text based protocol u may want to use. Also there are many existing javascript tools that can help you execute your ajax calls without much hustle e.g. jquery's $.ajax() function. On Fri, Dec 4, 2009 at 1:04 PM, michael nyangweso <mnyangweso@yahoo.com>wrote:
function setValue(controlName) { controlName.selected = true; }
<input type="text"
disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount2" id="amount2" value="true"/>
the first mistake is that you have to input types with the same name let name the second one amount2 to assign the value do amount2.value = "assignn here the value you calculated"
the create a function eg: this is where u need to set the field to true. function setValue(controlName) { controlName.selected = true; }
then on submit add this onclick="setValue(amount2);" this has always worked for me
******************************************** *nix is user friendly. It's just very particular about who it's friends are.
--- On Fri, 12/4/09, Calvin Omari <calvinebarongo@gmail.com> wrote:
From: Calvin Omari <calvinebarongo@gmail.com> Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP To: "Skunkworks Forum" <skunkworks@lists.my.co.ke> Date: Friday, December 4, 2009, 11:45 AM Michael Your suggestion sounds easier I have tried having my text inputs this way but it still not working <input type="text" disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount" id="amount" value="true"/>
Can you please check it for me, Thanks so much
On Fri, Dec 4, 2009 at 12:12 PM, michael nyangweso <mnyangweso@yahoo.com> wrote:
the trick is after doing the calculations and storing the values in a input or hidden field. it will display on the user side but when u submit the values will be blank. what u need is to set the value of the field to true when submitting the form
--- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com> wrote:
From: Peter Karunyu <pkarunyu@gmail.com>
Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP
To: "Skunkworks Forum" <skunkworks@lists.my.co.ke>
Date: Friday, December 4, 2009, 10:51 AM
Aki, here's the interesting part, you
can save and output XML to and from mysql!
I can't think of any reason one would want to do that,
but that didn't stop MySQL AB in having
it in 5.1
On Fri, Dec 4, 2009 at 11:31 AM,
aki <aki275@googlemail.com>
wrote:
On Fri, Dec 4,
2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>
wrote:
TI used javascript because
that is what i know and that is just piece of the code, I
have database declarations and captured the inputs of which
are not entered into the database, I think the big issue is
how do i capture users entering data that is bound to be
calculated at a standard rate eg users to enter first
milleage reading then last milleage reading , javascript or
any other to get the diffrence and then multiply by the rate
to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and
HTHs. 3 months ago, when drawing out the workflow and code
for the Mbytemeter program, I ran into issues with about
saving data. I had the options of using a SQL lite Db,
CSV or Excel file. The main problem I had was to store and
retrieve the data in an organized manner i.e each cell to
correspond with the data stored so that this data can be
retrieved by calls to that cell. So for example : In
Mybtemeter, it has an option to save Telco profiles. These
profiles contain data : Name , APN Value, UserName, Password
and DUN Number. When the program launches ( form load event
) it would populate a Drop Down Box with the stored
profiles ( using a query ). Then the other issue was, how
small and open was my program? Thus, I set out on XML and I
think it was a good decision. I think XML is amazing. ( and
the journey continues )
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-- Solomon Kariri, Software Developer, Cell: +254736 729 450 Skype: solomonkariri

Thanks guys for all the help and suggestion, imagine i used readonly="readonly" instead of disabled="disabled" and it worked, Lesson: when you doing calculations using javascript e.g you want to subtract some numbers using user inputbox, to avoid editing do not put disable as the db would not pick otherwise put readonly Thanks Calvin Omari On Fri, Dec 4, 2009 at 1:04 PM, michael nyangweso <mnyangweso@yahoo.com>wrote:
function setValue(controlName) { controlName.selected = true; }
<input type="text"
disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount2" id="amount2" value="true"/>
the first mistake is that you have to input types with the same name let name the second one amount2 to assign the value do amount2.value = "assignn here the value you calculated"
the create a function eg: this is where u need to set the field to true. function setValue(controlName) { controlName.selected = true; }
then on submit add this onclick="setValue(amount2);" this has always worked for me
******************************************** *nix is user friendly. It's just very particular about who it's friends are.
--- On Fri, 12/4/09, Calvin Omari <calvinebarongo@gmail.com> wrote:
From: Calvin Omari <calvinebarongo@gmail.com> Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP To: "Skunkworks Forum" <skunkworks@lists.my.co.ke> Date: Friday, December 4, 2009, 11:45 AM Michael Your suggestion sounds easier I have tried having my text inputs this way but it still not working <input type="text" disabled="disabled" name="amount" id="amount" class="required" />
<input type="hidden" name="amount" id="amount" value="true"/>
Can you please check it for me, Thanks so much
On Fri, Dec 4, 2009 at 12:12 PM, michael nyangweso <mnyangweso@yahoo.com> wrote:
the trick is after doing the calculations and storing the values in a input or hidden field. it will display on the user side but when u submit the values will be blank. what u need is to set the value of the field to true when submitting the form
--- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com> wrote:
From: Peter Karunyu <pkarunyu@gmail.com>
Subject: Re: [Skunkworks] capturing the javascript calculations in a mysql database PHP
To: "Skunkworks Forum" <skunkworks@lists.my.co.ke>
Date: Friday, December 4, 2009, 10:51 AM
Aki, here's the interesting part, you
can save and output XML to and from mysql!
I can't think of any reason one would want to do that,
but that didn't stop MySQL AB in having
it in 5.1
On Fri, Dec 4, 2009 at 11:31 AM,
aki <aki275@googlemail.com>
wrote:
On Fri, Dec 4,
2009 at 11:07 AM, Calvin Omari <calvinebarongo@gmail.com>
wrote:
TI used javascript because
that is what i know and that is just piece of the code, I
have database declarations and captured the inputs of which
are not entered into the database, I think the big issue is
how do i capture users entering data that is bound to be
calculated at a standard rate eg users to enter first
milleage reading then last milleage reading , javascript or
any other to get the diffrence and then multiply by the rate
to get what he or she is supposed to be payed/pay
Thanks again so much for your response
@Calvin, lemme sharing an insight with you and
HTHs. 3 months ago, when drawing out the workflow and code
for the Mbytemeter program, I ran into issues with about
saving data. I had the options of using a SQL lite Db,
CSV or Excel file. The main problem I had was to store and
retrieve the data in an organized manner i.e each cell to
correspond with the data stored so that this data can be
retrieved by calls to that cell. So for example : In
Mybtemeter, it has an option to save Telco profiles. These
profiles contain data : Name , APN Value, UserName, Password
and DUN Number. When the program launches ( form load event
) it would populate a Drop Down Box with the stored
profiles ( using a query ). Then the other issue was, how
small and open was my program? Thus, I set out on XML and I
think it was a good decision. I think XML is amazing. ( and
the journey continues )
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
------------
Skunkworks Rules
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke
Other lists
-------------
Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce
Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science
kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-----Inline Attachment Follows-----
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

On Mon, Dec 7, 2009 at 11:53 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Thanks guys for all the help and suggestion, imagine i used readonly="readonly" instead of disabled="disabled" and it worked, Lesson: when you doing calculations using javascript e.g you want to subtract some numbers using user inputbox, to avoid editing do not put disable as the db would not pick otherwise put readonly
Thanks
Calvin Omari
@Calvin, a question on the values. When using the work around, where are these values then stored? In memory until they processed? And when processed, are they moved to Db immediately? Are workarounds like a temp solution os the actual solution? Just wondering... Cheers. :-)

On Tue, Dec 8, 2009 at 11:05 AM, aki <aki275@googlemail.com> wrote:
@Calvin, a question on the values. When using the work around, where are these values then stored? In memory until they processed? And when processed, are they moved to Db immediately? Are workarounds like a temp solution os the actual solution? Just wondering...
Cheers. :-)
Can CouchDB play a role? Considering all interactions can be done via POST/GET/ through ajax calls, hence the PHP/Dynamic/Server-side language not a requirement - simply playing with javascript. HTML5?
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general

On Fri, Dec 4, 2009 at 11:51 AM, Peter Karunyu <pkarunyu@gmail.com> wrote:
Aki, here's the interesting part, you can save and output XML to and from mysql! I can't think of any reason one would want to do that, but that didn't stop MySQL AB in having it in 5.1<http://dev.mysql.com/doc/refman/5.1/en/xml-functions.html>
@Peter, thnks for the info. :-) The issue I have with using Dbs is network resources. Or if the close connection is written into a page exit, as you know end users, they will minimize the page and forget it there for a few days.... Memory is not a big deal these days, so loading an XML into memory for parsing ( hehehe...... I'm still a learner ), was not an issue. With MS Xlinq, it is even much faster to query. The other problem I have with using a Db is backups. On XML, I can create the app to create, write,read a file say in eg C:/ . I can then create an autoscript to save this file on regular intervals ( long term plan ). Ok, those who are Db gurus, what is the backup procedure for Dbs and can it be automated? Finally, the security exploits of writing bad queries in sql based system is a concern. I guess for very large apps, Dbs are necessary. But as a hobbyist I could be wrong. :-) Rgds.

Javascript by itself cannot access a database, but it can power an AJAX call, pass some values to the script being called (PHP, ASP, etc) and that script can then save that data in the database. Consider the code below, a typical DOM event driven ajax call, made easy by jQuery: <script type="text/javascript"> function checkAppointmentDateAvailability(){ $.ajax({ type: "POST", url: "includes/ajax-check-appointment-date.php", data: "appointment_date=" + document.getElementById("appointment_date").value, success: function(html){ $("#appointment_availability_div").html(html); } }); } </script> You can either do the calculation in JS then send the total amount to the script to be saved, or send the raw values to the script and it will do the calculations for you and save. On Fri, Dec 4, 2009 at 10:45 AM, Calvin Omari <calvinebarongo@gmail.com>wrote:
Hi all of you I have this application am making and its suppesd to make claims of refund, part of the script is here
But I cannot save this data into all the database
/*****************************************************************************************************************************/ function getValues(val){
var numVal1=parseInt(document.getElementById("milleage_start").value); var numVal2=parseInt(document.getElementById("milleage_finish").value); var numVal3=parseInt(document.getElementById("amount").value);
var rate = 35.00;
var totalValue = numVal1 - numVal2;
var totalAmount = totalValue * rate;
document.getElementById("milleage").value = totalValue;
document.getElementById("amount").value = totalAmount; }
/*****************************************************************************************************************************/
<td><div align="right">Finish</div></td> <td><input type="text" name="textfield9" id="milleage_start" class="required" onkeyup="getValues(1)"/></td> </tr> <tr> <td><div align="right">Start </div></td> <td><input type="text" name="textfield10" id="milleage_finish" class="required" onkeyup="getValues(2)" /></td> </tr> <tr> <td td bgcolor="#E0E0E0"><div align="left"><strong>Total Milleage (KM) </strong></div></td> <td td bgcolor="#E0E0E0"><strong> <input type="text" name="milleage" id="milleage" onkeyup="getValues(3)" class="required" values=""/> <input type="hidden" name="milleage" id="milleage" /> </strong></td> </tr> <tr> <td><div align="right">Amount in KShs </div></td> <td><strong> <input type="text" name="amount" id="amount" class="required" values="" /> <input type="hidden" name="amount" id="amount" /> (Rate @ Kshs 35)</strong></td>
Any idea and help will be most appreceated
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
participants (7)
-
aki
-
Calvin Omari
-
michael nyangweso
-
Peter Karunyu
-
solomon kariri
-
TheBigBoss
-
Ukang'a Dickson