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.
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> Date: Friday, December 4, 2009, 11:45 AM
> To: "Skunkworks Forum" <skunkworks@lists.my.co.ke>
> 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" />
>> id="amount" value="true"/>
> <input
> type="hidden" name="amount"
>
> 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:> --- On Fri, 12/4/09, Peter Karunyu <pkarunyu@gmail.com>
>
> 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
>
>
>
>
>
>
> 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> > On Fri, Dec 4,
> 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
>
> >
>
> >
>
>
> > 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
>
>
>
>
> -----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